Magical thinking in various forms is a cultural universal and an important aspect of religion. Magic is prevalent in all societies, regardless of whether they have organized religion or more general systems of animism or shamanism. Religion and magic became conceptually separated with the development of western monotheism, where the distinction arose between supernatural events sanctioned by mainstream religious doctrine (miracles) and magic rooted in folk belief or occult speculation.
In pre-monotheistic religious traditions, there is no fundamental distinction between religious practice and magic; tutelary deities concerned with magic are sometimes called hermetic deities or spirit guides.
Anthropology of religionEvolutionary origin of religion and Prehistoric religion
It is a postulate of modern anthropology, at least since early 1930s, that there is complete continuity between magic and religion.
Robert Ranulph Marett (1932) said:
Many leading anthropologists, including the author of The Golden Bough, would wholly or in the main refuse the title of religion to these almost inarticulate ceremonies of very humble folk. I am afraid, however, that I cannot follow them. [...] They are mysteries, and are therefore at least generically akin to religion. Moreover, they are held in the highest public esteem as of infinite worth whether in themselves or for their effects. To label them, then, with the opprobrious name of magic as if they were on a par with the mummeries that enable certain knaves to batten on the nerves of fools is quite unscientific; for it mixes up two things which the student of human culture must keep rigidly apart, namely, a normal development of the social life and one of its morbid by-products. Hence for me they belong to religion, but of course to rudimentary religion—to an early phase of the same world-wide institution that we know by that name among ourselves. I am bound to postulate the strictest continuity between these stages of what I have here undertaken to interpret as a natural growth.