A MOB attacked Alexander Aan even before an Indonesian court in June jailed him for two and a half years for “inciting religious hatred”. His crime was to write “God does not exist” on a Facebook group he had founded for atheists in Minang, a province of the world’s most populous Muslim nation. Like most non-believers in Islamic regions, he was brought up as a Muslim. And like many who profess godlessness openly, he has been punished.

In a handful of majority-Muslim countries atheists can live safely, if quietly; Turkey is one example, Lebanon another. None makes atheism a specific crime. But none gives atheists legal protection or recognition. Indonesia, for example, demands that people declare themselves as one of six religions; atheism and agnosticism do not count. Egypt’s draft constitution makes room for only three faiths: Christianity, Judaism and Islam.

Sharia law, which covers only Muslims unless incorporated into national law, assumes people are born into their parents’ religion. Thus ex-Muslim atheists are guilty of apostasy—a hudud crime against God, like adultery and drinking alcohol. Potential sanctions can be severe: eight states, including Iran, Saudi Arabia, Mauritania and Sudan have the death penalty on their statute books for such offences.

In reality such punishments are rarely meted out. Most atheists are prosecuted for blasphemy or for inciting hatred. (Atheists born to non-Muslim families are not considered apostates, but they can still be prosecuted for other crimes against religion.) Even in places where laws are lenient, religious authorities and social attitudes can be harsh, with vigilantes inflicting beatings or beheadings.

Many, like Kacem el-Ghazzali, a Moroccan, reckon the only solution is to escape abroad. The 23-year-old was granted asylum in Switzerland after people found out he was the author of an anonymous blog, Atheistica.com. Even in non-Muslim lands ex-believers are scared of being open, says Nahla Mahmoud, a 25-year-old Sudanese atheist who fled to Britain in 2010. “Muslim communities here don’t feel comfortable with having an ex-Muslim around,” she says, noting that extremists living in the West may harass non-believers there too.

Facebook groups for atheists, mostly pseudonymous, exist in almost every Muslim country. Social media give non-believers more clout—but also make them more conspicuous, and therefore vulnerable. But the real blame lies with religious intolerance. In the 1950s and 1960s secularism and tolerance prevailed in many majority-Muslim countries; today religion pervades public and political life. Sami Zubaida, a scholar at London’s Birkbeck College, speaks of increasing polarisation, with “growing religiosity at one end of the spectrum and growing atheism and secularism at the other.”

The rise to power of Islamist parties after the Arab revolutions is likely to make life more miserable still for those who leave Islam. New rulers in Tunisia and Egypt have jailed several young people who have been outspoken about their lack of belief. Such cases occurred before the revolutions, but seem to have become more common. Alber Saber Ayad, an Egyptian Christian activist who ran a Facebook page for atheists, has been in custody since September for “insulting religion”. His alleged offence was posting a link to an infamous YouTube video that caused protests in the Islamic world that month. He was arrested by a Christian policeman: Egypt’s Coptic church does not look kindly on atheism either.

Good news?

The Arab upheavals and the growing number of open non-believers have sparked some debate. In Egypt, Bassem Youssef, a doctor-cum-comedian, has bravely called for discussion rather than hostility. Islam co-existed with pagans and atheists at the height of its power, he writes. Some of the finest medieval Arabic and Persian poets and grammarians were atheists (though several were also famously executed).

Young activists, albeit often exiled, such as Mr Ghazzali, have become more vociferous about their right not to believe in a God. Organisations abroad for former Muslims are increasingly active, too. The Council of Ex-Muslims of Britain, set up by a group of non-believers five years ago, provides refuge for those who have renounced Islam and tries to “break the taboo” about apostasy.

In a move hailed by campaigners, Kuwait’s emir in June blocked a bill to make apostasy a capital offence. Yet seeking secular laws or social tolerance ignores the root of the problem, says Ibn Warraq, the pseudonymous Indian-born author of “Leaving Islam”, a collection of essays by ex-believers, and other books. He lives in exile and has received death threats for campaigning on the behalf of apostates. The prevailing interpretation of Islam, he says, simply cannot tolerate Muslim unbelievers. Arguments for the death penalty are usually based on a Hadith, one of the sayings which, along with the Koran, form the basis of Islamic law: “The Prophet said: whoever discards his religion, kill him.”

Yet other texts have a different message. The Koran’s notably tolerant Sura 109 includes words such as “For you is your religion, and for me is my religion.” Moderates also note that though the Koran says blasphemers will not be forgiven, it does not mention the death penalty. Some argue that in Islam’s early years apostasy was akin to treason, earning harsh penalties that are no longer acceptable.

Although some Islamic theologians interpret these provisions to mean that apostates will be punished in the afterlife, most see them as ordering that former Muslims must be punished by death. All four schools of Sunni Islamic law teach that male apostates should be put to death, though two say that female renegades should only be imprisoned. A number of leading Islamic figures, such as Egypt’s grand mufti and Yusuf al-Qaradawi, a Qatar-based preacher, say that the death penalty is deserved if the apostate “subverts society” or “damages Islam”. All agree, however, that repentant apostates should be spared; the time and sincerity needed for such disavowals to count is debated.

Ibn Warraq says that the nub of the problem is that sharia makes atheism the number one sin, ahead of murder. A theological debate on atheism has yet to begin. Public opinion, though variable, tends to the censorious. A 2010 survey by the Pew Research Centre, an American think-tank, found that 84% of Muslims in Egypt and 86% in Jordan backed the death penalty for apostates, compared with 51% in Nigeria and 30% in Indonesia.

Such attitudes may stoke atheist sentiment even as they deter its expression. Ms Mahmoud recalls how her primary school teacher punished her in art class for sketching a picture of Allah, which is forbidden in Islam. With fewer rights than her male peers and annoyed by a ban on studying evolution, she felt pushed away: “These incidents made me gradually refuse Islam until I completely renounced it and became an atheist.”