Attitudes towards God and immigrants can be altered by beaming magnetic energy into the brain, scientists have shown.

The bizarre experiment was designed to shed light on the way the brain resolves abstract ideological problems.

Using a technique called transcranial magnetic stimulation (TMS), the research team safely shut down certain groups of neurons in the brains of volunteers.

They found that doing this radically altered religious perceptions and prejudice. Strength of belief in God was reduced by almost a third, while participants became 28.5 per cent less negative in their feelings towards immigrants who criticised their country.

Dr Keise Izuma, from the University of York, said: "People often turn to ideology when they are confronted by problems. We wanted to find out whether a brain region that is linked with solving concrete problems, like deciding how to move one's body to overcome an obstacle, is also involved in solving abstract problems addressed by ideology."

The researchers targeted the posterior medial frontal cortex, a brain region a few inches up from the forehead that is associated with detecting and responding to problems.

Volunteers were asked how they rated their belief in God, angels, heaven, the devil, and hell after undergoing pre-screening to ensure that they held religious convictions.

Dr Izuma added: "We decided to remind people of death because previous research has shown that people turn to religion for comfort in the face of death.

"As expected, we found that when we experimentally turned down the posterior medial frontal cortex, people were less inclined to reach for comforting religious ideas despite having been reminded of death."

With regard to prejudice, the American participants were shown two essays ostensibly written by newly arrived immigrants. One was highly complimentary to the US and the other extremely critical.

"When we disrupted the brain region that usually helps detect and respond to threats, we saw a less negative, less ideologically motivated reaction to the critical author and his opinions," said Dr Izuma.

The research is published in the journal Social Cognitive and Affective Neuroscience.

Lead author Dr Colin Holbrook, from the University of California at Los Angeles, said: "These findings are very striking, and consistent with the idea that brain mechanisms that evolved for relatively basic threat-response functions are re-purposed to also produce ideological reactions."

The study suggests that whether we are trying to negotiate a fallen tree in our path, find solace in religion, or resolve issues related to immigration, our brains use the same basic mental machinery.