It sounds like a joke — but a new study out of the University of York in the UK finds that directing magnetic energy into the brain can change a person’s beliefs in God, as well as reduce their prejudice against immigrants.

Scientists from both the University of York and the University of California, Los Angeles (UCLA) tinkered with participants’ brains using magnetic energy, hoping to see whether certain brain regions were linked to ideology — such as feelings about religion and nationalism.

“People often turn to ideology when they are confronted by problems,” Dr. Keise Izuma, an author of the study, said in the press release. “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 divided the participants into two groups; the first received a placebo procedure that didn’t impact their brains, and the second one received energy targeting the posterior medial frontal cortex — a part of the brain that’s located a few inches above the forehead and is linked to detecting and responding to problems. The researchers asked all of the participants to think about death, then asked them about their religious beliefs as well as their thoughts on immigrants living in the U.S.

The second group, which received magnetic energy to the posterior medial frontal cortex (temporarily disabling it), experienced a 32.8 percent decrease in their belief in God, angels, or heaven. They were also 28.5 percent more positive when it came to immigrants who criticized their country.

“We decided to remind people of death because previous research has shown that people turn to religion for comfort in the face of death,” Izuma said in the press release. “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.”

Interestingly, when reviewing the participants’ beliefs on immigrants, the researchers had them read two essays written by immigrants. The first was complimentary toward the U.S., and the second criticized the country. It turns out that magnetic stimulation had the biggest impact on participants’ reaction to the critical author, making them more accepting of an immigrant with a critical view.

“We think that hearing criticisms of your group’s values, perhaps especially from a person you perceive as an outsider, is processed as an ideological sort of threat,” Izuma said in the press release. “One way to respond to such threats is to ‘double down’ on your group values, increasing your investment in them, and reacting more negatively to the critic. 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.”

Source: Izuma K, et al. Neuromodulation of Group Prejudice and Religious Belief. Social Cognitive and Affective Neuroscience. 2015.