I will let you into a little secret of mine. Every night, when I lie in bed, tucked under the duvet, I imagine myself flying a spacecraft to the stars. The craft is accelerating at relativistic speeds, often surpassing the speed of light as it heads out into the wider universe. It’s automatic, it’s comforting and it helps me fall asleep.

I’m sure many of us have similar mental rituals. Indeed, when I think about it, life is dominated by rituals that give us pleasure. What is our devotion to football, music and any of a million other pastimes and activities, but a kind of strange ritual? There is nothing life changing or cataclysmic about any of them – indeed from the outside they might seem a bit pointless and crazy – but without them life would be colourless. We need these regular indulgences.

Our brains seem to relish the familiar. Neural pathways, once laid down, are nourished by repeated use. Psychologists talk about “confirmation bias” – our tendency to absorb only that which appeals to us. But it’s much more than that. This comfort with the safe, the known and the well understood: it’s an essential part of our being.

Prayer is no different. For many, there is a comfort to be found in repeated recitations of the Our Father and the Rosary, or for others, the Islamic, Buddhist and Hindu chants. But there is something else about prayers that make them so compelling.

“To thee do we send forth our sighs,

Mourning and weeping in this valley of tears”.

The Salve Regina (aka “Hail Holy Queen”) is a thousand year old Catholic prayer. It speaks of a time when hardship was everywhere. Disease, brutality, avarice and accident could take everything away in seconds. If reality was so miserable, then why not accept a glorious fantasy? With a readymade industry of clerics and theologians willing to hone and interpret the myth (and punish non-belief), compliance would have been irresistible.

Reality is not so terrifying for many people nowadays. Medicine, law, technology and political reforms have made life vastly more tolerable. Religion has become optional, if not thoroughly second-rate. It’s not the only source of comfort anymore – instead we can indulge our passions, listen to music, play video games or surf the Internet. We are less dependent on heavenly promises to help us get through life.

I’m an atheist. For me, these old stories are no more realistic than Harry Potter. But nevertheless, I wonder how my worldview would have been shaped had I been born to a life of oppression and drudgery, where the pleasures I take for granted were not easily available?

There are plenty of people living lives devoid of freedom, security or hope. All they have are their prayers. We atheists need to understand this. It’s not enough to tell such people they are living a delusion if we cannot demonstrate alternative – and realistic – routes to fulfilment and mental health. Indeed, if prayer is the only comfort they have, who are we to deprive them even of this? We need to address the underlying causes.

Until then? Religion is here to stay.