I am a Hindu by birth. Though I am related to a few believers, most of my immediate family is agnostic. Even then I was exposed often enough to havans and pujas growing up.

About five or six years into my nonconformist life, I asked a religious relative if she knew where the gods resided. I was told that they lived in the mountains. Shortly thereafter, I managed to climb a mountain near where we lived but was disappointed to see the beautiful panorama around me and no gods. Immediately upon my return, I tried to find the whereabouts of gods, only to be told that they had moved to the skies. A few years later I embarked on my maiden flight, from Surat to Bombay, but was again disappointed to not find any gods high up above the clouds. Later that day, my exasperation was met with a gentle retort by an elder in the family asking me to look for gods in everyone around me and within my own self.

I have since grown up to be a bona fide atheist. But the question of how I had atheistic traits as a child growing up in a family of agnostics and believers has bothered me so much that I have narrated my story often in person and once even on social media. Fortunately, it seems science is beginning to come up with an answer about the origin of the concept of religion and god, albeit a partial one. And the elder person in my family was right when he asked me to search for gods within my own self. God may just be within us – in our minds.

Some neuroscientists are now convinced that religious beliefs are a product of the human brain. They represent a safety mechanism with a neurobiological basis that has developed with evolution to help humans deal better with stress. This claim is backed by several studies. Research in 2009 using electrophysiological data showed that believers are able to buffer anxiety and stress better than the non-believers. Further research using magnetic resonance imaging data has documented that spiritual and religious practices protect against depression. And even just the thoughts of religion and god decrease distress among believers. A study has also documented that religious experiences trigger the same reward and pleasure systems within the brain that are activated by taking drugs.

Research has shown that those with religious beliefs activate the brain networks associated with moral, social and emotional insights to a greater extent while suppressing the networks associated with analytical reasoning. Moreover, meticulous experiments have revealed that prompting study participants to analytical thinking, either by showing them a photo of Rodin’s The Thinker or making them read text with complex fonts, led to a decrease in their religious belief.

Indirect evidence is also accumulating. A study from 2015 noted that applying a magnetic field on a region in the human brain called posterior medial frontal cortex decreased participants’ religious beliefs. A study published last month has suggested that damage to particular regions of the brain is associated with religious fundamentalism. These findings would have to be reproduced to be confirmed but they do raise an interesting question of whether religious fundamentalism can potentially be modulated or treated in the future.

Over the years, I have learnt to evade most discussions of religion and god as they can be polarising and exhausting. Recently, a Hindu friend asked me if my science will ever find his gods or negate their existence. Not soon: our science is handicapped by the limitations of our own brains. But evolution over thousands of years in the right direction will most likely solve the quandary. Artificial intelligence may even supersede us and get there first.

Religion is a phenomenon that has evolved with Homo sapiens. It will likely fade away with further evolution when we have better regulation of our emotions and more refined ways of handling stress. The other possibility is of its demise with human extinction because religious and quasi-religious practices in rest of the animal kingdom are limited if at all existent.

Jay Desai is a neurologist. He tweets @southgujarati. The views above are of the author and not the publisher.