The relationship between magic and religion has been debated by anthropologists dating back to the 19th Century but a choice is yet to be reached concerning whether there exists a fixed boundary between the two. E. B. Tylor and J. G. Frazer both conducted research in to the separate nature of both belief systems and came to the general conclusion that 'magic had not been a false religion, but another type of type of activity altogether' (REF1) and was in many ways seen to be in direct conflict with religion. The opposing argument in cases like this is reflected in the work of E. E. Evans-Pritchard and his studies in to the nature of witchcraft in the Azande tribe surviving in North Central Africa. Evans-Pritchard found that although such beliefs were illogical when viewed from an outsider's perspective, by entering into the society itself and so performing an ethnographical study, he could gain a much greater insight into the Azande's belief system and noticed it possessed several similarities to that of any religious system. Therefore we can see that there exists great difficulty when wanting to define a set boundary between the two as the terms "Magic" and "Religion" aren't at the mercy of set definitions themselves. (204)
Throughout history there is proof a conflict between magic and religion with religious systems not only acknowledging the difference between religion and magic but going so far as to reject magic completely. (REF2) The Church's involvement in the prosecution of these believed to possess magic has changed as time passes due to public pressure and demand to do this. Originally it was greatly frowned upon to label someone as a witch and it was said that 'whoever lays that reputation upon a full time income being shall not be received into the Church' (REF3). However, this view changed over centuries with church heretics now being labelled as witches and the prosecution of many of the accused occurring at the hands of the church authorities themselves. (REF4) However the Church did somewhat attempt to keep control of the problem it's obvious to see that, at least in Western religions, 'religious tradition defines  the unacceptable as magic' (REF5) therefore would strongly preach a boundary between them. (367)
In his extended work "The Golden Bough", Frazer also develops the thought of a set boundary existing between religion and magic and suggests that at some point in time there must have existed an interval of transition from one to the other which is now developing into the scientific way of life we see today. Frazer describes magic as a primitive form of technology through which believers would try to make clear or affect nature through objects considered to have the contagious or sympathetic link to each other. That is then accompanied by religion which develops as something of the failings of magic and the resulting realisation that control over nature had not been possessed by humans therefore there must exist external forces or beings which occupy such control. The thought of a higher, spiritual power were a more robust theory than that of magic, with all hardships or misfortunes being accounted for as part of a greater, divine plan, however there is still no hard evidence to back up these claims. Another stage of human development proposed by Frazer is that of science and rationalism which he states serves as a a far more advanced version of the initial magical beliefs. This link between magic and science is paramount to the use of Frazer's work to argue the existence of a fixed boundary between religion and magic as it presents the view that '[Religion] stands in fundamental antagonism to magic as well concerning science' (REF6). For Frazer, both science and magic are the results of the principles of association, which when properly applied lead to science; however an incorrect connection results magic. These two principles can be considered the same as both are based upon a genuine and firm faith in the order and uniformity of nature; this cannot be said of religion as its systems differ across countries and historical periods whereas magic remains constant. (REF7). Frazer uses this as evidence for the truth of science and the attempts created by magic to reach the same conclusions, but also to dismiss religion as incorrect and irrational. He advocates the existence of magic without religion sooner or later ever sold and states that it is the belief in supernatural beings and their control around the world which causes the movement from the realm of magic to that of religion and thus separates the two (REF8). You can find some discrepancy over the connection of magic and science and whether this necessarily excludes religion completely. Belief in witchcraft, such as that displayed by the Azande, in no way contradicts empirical understanding of cause and effect; the Azande were still scientific in their understanding of just how nature operated and used witchcraft to describe that which cannot otherwise be explained, a role often fulfilled by religion in society. This undertake religion, often referred to as a 'God-of-the-Gaps theology' (REF9) therefore can be consider to execute the same role as witchcraft and belief in magic in such cases. Furthermore, in society, scientific theory is excluded in matters of moral and legal responsibility and the same pertains to the Azande belief in witchcraft. With regards to the society in question, religion is often also excluded rather than taken as acceptable reasoning for breaches or law or morals such as in the case of sacrifices or honour killings (REF10). These similarities between religion and magic, also to a certain extent science, help distort the clear distinctions between your belief systems therefore make it harder to find out a fixed boundary between religion and magic. ( 963)
'Both Tylor and Frazer distinguished between magic[ ], a belief in impersonal forces, and religion, a belief in personal supernatural being' (REF11), which when viewed in this respect acts as a definitive difference between the two, therefore providing a set boundary with which to split up them. However, points raised by both Tylor and Frazer may be used to call focus on compelling similarities between magic and religion.
One of the key similarities between your two belief systems is their importance to the functioning of the society in which they are really held. Emile Durkheim stressed the necessity for religion as a way of maintaining social order as it offers a couple of moral codes by which to live on and something of reward and punishment for abiding by these codes, thus Gods or some type of higher power are accountable for keeping society functioning within certain boundaries 'for it is by worshipping and serving them that this regenerates itself and strengthens and renews its commitment to its values' (REF12). Exactly the same can be said for witchcraft, as it exists within the Azande culture, as it encourages seeking and providing forgiveness for past wrongdoings to be able to relieve the 'curse' put upon you. In addition, as witchcraft would not act as the best excuse for committing such sins as adultery or murder, it maintains that such acts are wrong and are a matter of personal choice and then the individual is held personally accountable. By offering rewards to those who achieve forgiveness, in the form of the cease of witchcraft, and punishment to the people who commit moral wrongdoings, by means of exile or death, witchcraft really helps to supply the community with a solid set of social regulations and for that reason maintain social control. Evans-Pritchard found that for the Azande, witchcraft offers a social structure similar to that of the Church, with oracles and witchdoctors possessing different qualities and powers which denote their different ranks within the city. This technique of ordering society can be an important factor which helps to blend religion and magic together therefore make it harder to define a set boundary between them.
The emotional aspect of religion and magic is another component which is common of such belief systems. According to Frazer, witchcraft has an explanation for the outcome of a series of events which otherwise can't be explained (REF13) which is associated to religion and it's really tendency to clarify otherwise unexplainable events as part of a larger divine plan or the result of bad actions committed in a previous life. When viewed in this respect, science can be linked to religion and magic once again as 'whether explanations for illness are "scientific" or "mystical", all societies must have explanations for crises' (REF14). All three systems of belief provide members of the society with an all natural philosophy which really helps to explain both negative and positive events that take place in their lives and offer a way of reacting to them. Sigmund Freud saw the emotional aspect of religion as very important when attempting to explain why people choose to check out a religion and stated that 'Religious ideas  are charged with an exceptionally suggestive, emotional power. ' (REF15) This works just as as the Azande's belief of witchcraft as a second spear, in both cultures a good friend or family member having an illness would be explained in scientific terms; they can be elderly and so more vunerable to disease or they have got caught the condition by participating in a specific activity for example, as the first spear. However, if the individual is then to die from the condition, this is the influence of the next spear, in the Azande case, witchcraft, or in a religious sense, the will of God within His divine plan. This might provide comfort to the family of the deceased that everyone involved had done everything they could to help the average person recover but it was the work of the force beyond human control that was accountable for the results, not human error or neglect. Therefore, when viewed as a provider of emotional comfort, both religion and magic fulfil the same function and so dismiss the thought of a fixed boundary existing between them. (705 
As briefly mentioned earlier, witchcraft and religion both own a similar degree of emphasis on maintaining a high moral standard within society, at least in some instances. In a few societies, generally those associated with being either primitive or less developed compared with modern western civilisation, religious ceremonies include the ritual sacrificing of animal or even human life, albeit the more rare of both, or contain beliefs that, when ignored, call for murder or other generally unacceptable moral breaches in the name of honour. In modern, westernised societies, religion wouldn't normally provide a legitimate excuse for committing such crimes and the same attitude is displayed in the Azande tribe who reject any claims of witchcraft having caused someone to commit acts that have been considered to go against moral guidelines. Consequently, here we can easily see another area in which there lacks a specific difference between religion and magic; in both cases, not every negative event is accounted for by God's will or witchcraft, carelessness, ignorance and insufficient morals remain discouraged and found to be the reason for many negative events. (REF16) In case a farmer's crops didn't grow because he did not give them the right amount of water and nutrients then the cause would be his inexperience or forgetfulness, not God or witchcraft. However, if the farmer completed all of the required tasks to the best of his ability and usually succeeded in so doing but the crops failed to grow, then this may be related to witchcraft or God as it might be considered an otherwise unexplainable event. Out of this we can evidently notice that neither religious nor magical societies, generally, enable breach of moral laws due to their faith. This displays an optimistic aspect of the two systems that is common and so clouds any set distinction between the two. (309 )
Generally, it could be said that whenever viewed from a less detailed perspective; both religion and magic appear to match into many of the wider definitions often applied to religion in the modern day and fulfil a few of the same functions both within society and to the average person. 'One essential requirement of religion is helping believers to come quickly to know the unknown', (REF17) an aspect which is exhibited in Azande witchcraft beliefs by using Oracles and Witchdoctors to discover the reality about the origin of the curse and what implications it has on those who are subject to it. Helping to uncover or predict the unknown is merely one of the many examples of how magic and religion perform the same occupations for believers and plays a part in forming a broader definition of the two as similar systems. Both religion and magic provide 'ways of dealing with the supernatural, explaining the unexplainable, attempting to control or manipulate what otherwise can't be controlled' and a social structure which helps to dictate how believers live their lives. In this respect, there is merely a boundary between the two when considered in more detail and studying the individual beliefs and practices separately. Despite these slight dissimilarities in beliefs and practices, there is certainly evidence to suggest that at some point ever sold, there didn't exist a boundary between religion and magic, or if one did exist then it was barely visible. Both Tylor and Frazer 'viewed magic and religion in primitive societies as beliefs and practices that attempted to interpret the planet rationally and achieve worldly goals'. (REF18) In his work, The Golden Bough, Frazer proposed that at some point in time, the functions of priest and sorcerer were the same and could have even been combined, he also suggested that through the transition between magic and religion, which would have taken place slowly but surely over hundreds of years, there may have been the belief that the God's were magic. (REF19) Furthermore, in a few societies, it was thought that witches inherited their 'power for evil or [was] given the power by God'. (REF20) It offers even been claimed by some that Jesus was a magician as he portrayed such traits as being in a position to perform miracles and healing the sick, acts often associated with magic or an otherworldly power. (REF21) Thus, although a distinction between religion and magic may exist in today's day, it is highly possible that at some point in the past, the two systems were considered as one or at the minimum performed functions so similar that they were impossible to separate. (434)
In conclusion, there are a number of strong similarities between religion and magic although there does look like some distinctions which form a boundary between the two. It's been agreed by a lot of those who've studied magic and religion that there surely is an over-all trend running through them; both have a metaphysical sense and involve something is outside of complete human control. Tylor found religion 'to generally resemble magic' (REF22) which is echoed by William James' view of religion 'as the belief within an unseen order', (REF23) something may easily be said of magic. Both Frazer and Evans-Pritchard also saw a simple connection between the two systems and suggested that they acted as separate strains of human reason, which remains the same globally, but is expressed differently according to culture and also varies over time. However, it is undeniable that we now have aspects of each belief system that not only contrast but are incompatible with each other. Religion is most widely focused on the fact that there are always a group of powers superior to man which have control over nature whereas magic emphasises human control. Furthermore, Tylor defined religion as 'belief in spiritual beings' (REF25) and also magic also deals with spirits in a few respect, when it does so, it identifies them as inanimate objects rather than sentient beings. Your final example of a significant difference between religion and magic is the fact that 'Magic is not a uniform class of practices and beliefs that can be immediately discerned in every society', (REF26) especially in society. Science has made it extremely difficult for a belief in magic to survive in modern cultures, specifically those in Western Europe, as it offers definitive explanations for the acts of nature and as a result, negates the claims created by magic. On the other hand, Religion has survived the introduction of scientific explanations as science has yet been unable to prove Religion as entirely false and merely casts speculation onto a few of the finer information on specific religious beliefs. Additionally, science cannot provide answers to all or any questions posed about the type of human life and reason behind our existence therefore many consider religion.
Overall, it could be said that 'One group's holy man is another group's magician'; (REF27) there exists a boundary between "religion" and "magic", lay out by the stark differences between your two but this boundary is not fixed and is also at the mercy of debate because of this of many similarities between the two systems. (416)