When I was 12, on family vacation in New Mexico, I watched a group of elaborately-costumed Navajo men belt out one intimidating song after the next. They executed a set of beautifully coordinated dance turns to honour the four cardinal directions, each one symbolising sacred gifts from the gods. Yet the tourist-packed audience lost interest and my family, too, prepared to leave. Then, all of a sudden, the dancers were surprised by a haunting, muscled old man adorned with strange pendants, animal skulls, and scars etching patterns into his body and face.

Because the dancers were obviously terrified of this man I, too, became afraid and wanted to run, but we all stood rooted to the spot as he walked silently and majestically into the desert night. Afterwards, the lead dancer apologised profusely for the tribe’s shaman, or medicine man: he was holy but a bit eccentric. My 12-year-old self wondered how one might become like this extraordinary individual, so singular, respected and brave he could take the desert night alone.

That question has fuelled much of my neuroscience through the years. As I studied the brain, I found that the right arrangement of neural circuitry and chemistry could generate astonishingly creative and holy persons on the one hand, or profoundly delusional, even violent, fanatics on the other. To intensify the ‘god effect’ in people already attracted to religious ideas, my studies revealed, all we had to do was boost the activity of the neurotransmitter, dopamine, crucial for balanced emotion and thought, on the right side of the brain. But should dopamine spike too high, murderous impulses like terrorism and jihad could rear up instead.

Evidence that religion can produce extraordinary behaviours goes back to the dawn of human history, when our ancestors started burying the dead and produced remarkable, ritual art on cave walls. One of the first signs of religious consciousness dates to the upper Paleolithic, some 25,000 years ago, when a boy, also about age 12, crawled through hundreds of metres of pitch black, deep cave space, probably guided only by a flickering flame held in one hand and some fleetingly illuminated paintings on cave walls. When the boy reached a cul-de-sac in the bowels of the cave, he put red ochre onto his hand and made a print on the wall. Then he climbed out of the cul-de-sac and – we can surmise, given his skill and the fact that his bones have not been found – made it out alive.

But where did this boy get his courage? And why leave a handprint on the wall of a remote cave deep in the bowels of the earth? Some experts in cave art think the boy was performing a religious obligation. He, like others who made similar treks into the caves, was leaving a votive offering to the spirit world or gods and becoming a holy man – much like the majestic and terrifying Indian man I had seen when I was 12.

Dopamine probably fuelled his brain.

Throughout the centuries, bountiful dopamine has given rise to gifted leaders and peacemakers (Gandhi, Martin Luther King, Catherine of Siena), innovators (Zoroaster), seers (the Buddha), warriors (Napoleon, Joan of Arc), teachers of whole civilisations (Confucius) and visionaries (Laozi). Some of them founded not only enduring religious traditions but also profoundly influenced the cultures and civilisations associated with those traditions. But dopamine-fuelled religion has also unleashed monsters: Jim Jones (the ‘minister’ who persuaded hundreds of his followers to commit suicide) and the cult Aum Shinrikyo, whose leader had his adherents release sarin gas on the subways of Japan. Think of the fanatic terrorists of al Qaeda, who gave their lives to attack New York’s twin towers and the Pentagon on 11 September 2001.

The neurological line between the saint and the savage, the creative and the unconscionable, turns out to be razor-thin

As 9/11 suggests, the neurological line between the saint and the savage, the creative and the unconscionable, turns out to be razor-thin. Just look at the bounty of evidence showing that families of extraordinarily creative individuals often include members with histories of insanity, sometimes even criminal insanity. Genes that produce brains capable of unusually creative associations or ideas are also more likely to produce (in the same individual or in members of his/her family) brains vulnerable to loose or bizarre associations.

The medical literature abounds with descriptions of creative bursts following infusion of dopamine-enhancing drugs such as l-dopa (levodopa), used to treat Parkinson’s Disease (PD). Bipolar illness, which sends sufferers into prolonged bouts of dopamine-fuelled mania followed by devastating spells of depressive illness, can sometimes produce work of amazing virtuosity during the manic phase. Often these individuals refuse to take anti-dopamine drugs that can prevent the manic episodes precisely because they value the creative activity of which they are capable during these altered states.

Hallucinogenic drugs such as Psilocybin and LSD, which indirectly stimulate dopamine activity in the brain’s frontal lobes, can produce religious experience even in the avowedly non-religious. These hallucinogens produce vivid imagery, sometimes along with near psychotic breaks or intense spiritual experience, all tied to stimulation of dopamine receptors on neurons in the limbic system, the seat of emotion located in the midbrain, and in the prefrontal cortex, the upper brain that is the centre of complex thought.

Given all these fascinating correlations, sometime after the attack on the twin towers in New York City, I began to hypothesise that dopamine might provide a simple explanation for the paradoxical god effect. When dopamine in the limbic and prefrontal regions of the brain was high, but not too high, it would produce the ability to entertain unusual ideas and associations, leading to heightened creativity, inspired leadership and profound religious experience. When dopamine was too high, however, it would produce mental illness in genetically vulnerable individuals. In those who had been religious before, fanaticism could be the result.

While pursuing these ideas, I had a lucky break during routine office hours at the VA (Veterans Administration) Boston Healthcare System, where I regularly treat US veterans. I was doing a routine neuropsychological examination of a tall, distinguished elderly man with Parkinson’s Disease. This man was a decorated Second World War veteran and obviously intelligent. He had made his living as a consulting engineer but had slowly withdrawn from the working world as his symptoms progressed. His withdrawal was selective: he did not quit everything, his wife explained. ‘Just social parts of his work, some physical stuff and unfortunately his private religious devotions.’

When I asked what she meant by ‘devotions’ she replied that he used to pray and read his Bible all the time, but since the onset of the disease he had done so less and less. When I asked the patient himself about his religious interests, he replied that they seemed to have vanished. What was so striking was that he said he was quite unhappy about that fact. What appeared to be keeping him from his ‘devotions’ was that he found them ‘hard to fathom’. He had not stopped wanting to believe and practise his religion but simply found it more difficult to do so.

This was a man whose intelligence was above average, who apparently had been religious all his life and who could easily answer questions about religious ideas and doctrines. It was not an intellectual deficit that was the problem. When I asked him directly whether he had now rejected religion as false he said: ‘By no means!’ The difficulty he had was accessing his religious memories, feelings and experiences, in particular. Other equally complex ideas were still easily available to him, but religion as a sphere of interest for this man was nearly impossible.

The primary pathology associated with PD is a loss of dopamine activity, hypothesised for years to drive ‘hedonic reward’ or pleasure – that sense of well-being we all feel when we indulge in an experience like good food or sex. Whenever dopamine release occurred, proponents held, we would get a small hit of pleasure. That story made sense because many drugs of abuse, such as cocaine or amphetamine, stimulate dopamine activity in the midbrain.

But recent research had revealed something more complex. A Cambridge University neuroscientist named Wolfram Schultz had shown that dopamine was not a simple pleasure molecule, delivering a simple reward. Instead, it alerted us only to unexpected rewards, spiking when the prize delivered far exceeded the expected result.

Unexpected visions can define the most innovative artists, the most divergent philosophers and anyone who finds a sense of ecstasy in the beauty and strangeness of the world

To tease out this nuance, Schultz used a simple experimental design: he delivered varying quantities of fruit juice to monkeys while simultaneously recording activity in the monkey’s midbrain, the seat of emotion, where dopamine neurons were dense. He found that the neurons fired most intensely not when the monkey got a juice reward but when that reward was unexpectedly large. In short, dopamine neurons were oriented towards the pickup of new and significant rewards, novelty of the highest order for the individual. Since Schultz’s pioneering work in the midbrain, others have mapped out similar signalling patterns when dopamine activity moves into the prefrontal lobes, which mediate the most complex of thinking and creative processes, unique to humans.

But how would these new findings explain my PD patient’s difficulty in accessing religious ideas? Suppose religion created spectacular individuals because it pushed them into looking for unexpected rewards – a sense of transcendence or the pleasure of doing good – rather than all the usual rewards such as money or sex that the rest of us constantly pursue. Pursuit of unusual ideas could likewise be facilitated by dopamine, heightening creativity, too.

Here, I thought, was where science and religion actually meet. Like the most creative scientists, the most consistently religious individuals would be motivated only by things that consistently triggered surging dopamine and the unexpected rewards circuits in the prefrontal lobes of the brain: awe, fear, reverence and wonder. Such unexpected visions would define the most innovative artists, the most divergent philosophers and anyone who could find a sense of ecstasy in the beauty and strangeness of the world. In the genetically vulnerable, it would take just a little more juice to activate homicidal fanatics like the terrorists of 9/11.

Again, I tested these ideas on my PD patients. After screening for ‘religiousness’ through a questionnaire given to 71 vets in all, I found that a pattern was emerging. Of those with religious leanings prior to getting sick, only a subgroup lost religious fervour after illness set in. These were patients with ‘left-onset disease’ – meaning that their muscle problems had begun on the left side of the body, correlating with dysfunction in the right prefrontal regions of the brain. Those with left-onset disease reported significantly lower scores on all dimensions of religiosity (spiritual experiences, daily rituals, prayer and meditation) compared to those with right-onset disease.

How could I explain these results? I surmised it was loss of dopamine in the right half of the brain. To test that hypothesis, my team devised a ‘priming’ experiment to see if PD patients could access religious concepts as easily as other, equally complex ideas. To conduct priming experiments, you typically ‘prime’ or briefly present, a person with a word semantically related to a second, target word. For instance, the word ‘rose’ can be used as a prime for ‘violet’. The target word, ‘violet’, will be more quickly recognised following a prime with ‘rose’ than it would be if the prime had been something unrelated, such as ‘stamp’.

In our priming experiments with religious words we found that healthy volunteers were much quicker to recognise ‘worship God’ as a valid phrase when they were first presented with ‘pray quietly’ as compared with a control phrase. But this did not hold for PD patients with left-onset disease and damage on the right side of the brain! Relative to both right-onset PD patients and healthy volunteers, patients with left-onset disease did not benefit from subliminal presentation of the religious phrase, although their priming patterns for non-religious control phrases such as ‘pay taxes’ and ‘serve jury’ were normal in every way. These findings convinced me that my theory was at least partially correct: the dopamine receptors responsible for that transcendent, outsize sense of reward were dysfunctional on the right side of the brain.

But I still had to rule out competing ideas. One long-standing theory, suggested most prominently by Freud, ascribes religious commitment to anxiety. Put simply, the theory says that religion with its promise of an afterlife quells the free-floating anxiety caused by fear of death. This was a problem for me, given that my unexpected rewards theory of religion predicts the exact opposite: rather than eschewing fear, the religious would seek it out as one of the most novel, exciting and intense emotions served up by the brain.

I therefore attempted to pit the two theories against one another in another priming experiment. Over the course of several interview sessions, I told my PD patients a short story about a person climbing stairs in a hospital, ultimately coming across a surprise. Only the last sentence differed from one version to the next. In one ending the person witnessed a death; in a second he witnessed a religious ritual; and in the third, he saw a breathtaking view of the ocean. After participants were presented with each of these primes, they were tested for subtle changes in attitudes to religious belief by rating agreement with the statements ‘God or some supreme being exists’ and ‘God is an active agent in the world’.

In healthy volunteers and right- but not left-onset patients, religious belief-scores significantly increased following the aesthetic prime consisting of the ocean view (a wonderful reward) but not the death prime. (The religious ritual prime increased religious belief only inconsistently, with little impact compared with that of the ocean view.) The results directly refuted the anxiety theory of religion while supporting the notion that religiosity was spurred by the quest for unexpected reward.

What does all this say about how religion can produce both extraordinarily life-giving and generative human beings (holy men and women) and extraordinary monsters? The same mechanism that enhances our creativity – juicing up the right-sided limbic and prefrontal brain regions with dopamine – also opens us up to religious ideas and experience. But if these brain circuits are pushed too far, thinking becomes not merely divergent but outright deviant and psychotic.

Since at least the upper Paleolithic, religious cultures have been shaping, channelling and nourishing the quest for unexpected rewards. Today, such cultures as science, art, music, literature and philosophy confer the same sense of transcendence that religion has done in the past. The trick is tapping the god effect, inducing that altered state of wonder and making the breakthrough to greatness without going over the edge.