“IF THERE is a God, atheism must seem to Him as less of an insult than religion,” Edmond de Goncourt, a French writer, once said. He would not find much agreement in most of the Islamic world. In late February a Saudi Arabian man in his 20s was sentenced to ten years in prison, a hefty fine and 2,000 lashes for professing his atheism on Twitter. He could well have fared even worse. In 2014 Saudi Arabia passed a law equating atheism with terrorism. When last year another young man uploaded an online video of himself tearing up a Koran, Saudi courts sentenced him to death.

According to the International Humanist and Ethical Union, a pressure group, Saudi Arabia is one of only 19 countries in the world that criminalises apostasy, the turning away from one religion to another one, or to none; it is one of 12 countries where it is punishable by death. All but two of the latter group are in the Middle East and Africa. In practice, the death sentences are rarely carried out; more commonly, apostates are merely thrown in jail and tortured.

Even countries with civil laws that do not expressly outlaw apostasy still find creative ways to crack down on religious deviation. In Oman, Kuwait and Jordan Islamic courts can annul the marriages of apostates or prevent them from inheriting property. In Pakistan couples who convert from Islam risk having their children taken away.

Where laws against apostasy do not exist, blasphemy laws are often applied instead. In Egypt, a 21-year-old student, Karim Ashraf Muhammad al-Banna, was sentenced to three years in prison last year after he broadcast his atheism on Facebook. Atheism itself is not illegal in Egypt; instead Mr al-Banna was charged with insulting religion. Blasphemy laws were famously applied in Pakistan too, when, Asia Bibi, a Pakistani Christian, was sentenced to death in 2010 after a confrontation with a group of Muslim women in which she supposedly defamed the Prophet Muhammad. Salman Taseer, the governor of Punjab, who defended Ms Bibi and railed against the blasphemy laws, was murdered by his own bodyguard in 2011.

Not everyone in the region is so ardent. Despite the great risks associated with religious doubt in the Islamic world, curiosity about atheism seems to thrive. According to Google Trends, all of the seven countries most interested in the term “atheism” are in the Middle East. Still, a survey by WIN/Gallup International in 2012 suggested that Brazilians were more religious than Afghans and Armenians more zealous than Iraqis. Perhaps not wholly surprisingly, the proportion of Saudis reporting themselves to be “convinced atheists” was about the same as for Americans.