ONE leaflet showed a wooden doll hanging from a noose and suggested burning or stoning homosexuals. “God Abhors You” read another. A third warned gays: “Turn or Burn”. Three Muslim men who handed out the leaflets in the English city of Derby were convicted of hate crimes on January 20th. One of them, Kabir Ahmed, said his Muslim duty was “to give the message”.

That message—at least in the eyes of religious purists— is uncompromising condemnation. Of the seven countries that impose the death penalty for homosexuality, all are Muslim. Even when gays do not face execution, persecution is endemic. In 2010 a Saudi man was sentenced to 500 lashes and five years in jail for having sex with another man. In February last year, police in Bahrain arrested scores of men, mostly other Gulf nationals, at a “gay party”. Iranian gay men are typically tried on other trumped-up charges. But in September last year three were executed specifically for homosexuality. (Lesbians in Muslim countries tend to have an easier time: in Iran they are sentenced to death only on the fourth conviction.)

In this section

Gay life in the open in Muslim-majority countries is rare, but the closet is spacious. Countries with fierce laws, such as Saudi Arabia, also have flourishing gay scenes at all levels of society. Syria's otherwise fearsome police rarely arrest gays. Sibkeh park in Damascus is a tree-filled children's playground during the day. By night it is known for the young men who linger on its benches or walls. Wealthy Afghans buy bachabazi, (dancing boys) as catamites.

Where laws are gentler, authorities find other ways to crack down. In the Jordanian capital, Amman, several gay hangouts have been raided or closed on bogus charges, such as serving alcohol illegally. Even where homosexuality is legal (as in Turkey), official censure can be fierce. A former minister for women's affairs, Aliye Kavaf, called it “a disease”; the interior minister, Idris Naim Sahin, cited it (along with Zoroastrianism and eating pork) as an example of “dishonour, immorality and inhuman situations”. A new film, “Zenne Dancer”, portrays a young man's murder in 2008 as Turkey's first gay “honour killing” (the suspect, the victim's father, is on the run).

Charges of homosexuality can also be used in political repression. The Malaysian opposition leader, Anwar Ibrahim, was twice tried for sodomy; the attorney-general is appealing against the latest acquittal. Intolerance can unite otherwise warring factions. In Nigeria Muslims and conservative Christians alike back a proposed law banning gay marriage (and indirectly criminalising all same-sex unions).

The democratic upheavals of the Arab spring have brought little comfort. Hossein Alizadeh of the International Gay and Lesbian Human Rights Commission, a New York-based lobby group, says that religious awakening is strengthening hardline interpretations of Islam and a repressive backlash on all kinds of sex-related issues. But the laws left behind by the former regimes in countries such as Tunisia and Egypt seem draconian enough to satisfy the new governments.

An ominous counter-example is Iraq. The previous Iraqi regime was politically repressive but unbothered by sexual mores. Now men even suspected of being gay face kidnappings, rape, torture and extrajudicial killing. Ali Hili, head of a group called Iraqi LGBT, (Lesbian, Gay, Bisexual and Transgender) says that since the 2003 invasion more than 700 people have been killed because of their sexuality. It is the most dangerous place in the world for sexual minorities, he says.

Theology or technology

One small source of hope is the internet: life online offers gays safety, secrecy and the chance to make their case. In a campaign called “We are everywhere” Iranian gays and lesbians are posting protest videos on Facebook. In one, entitled “Ali the Queer”, a man speaks of his longing for a world in which those who deviate from the heterosexual standard are no longer considered unnatural or abnormal. However, a video newly posted from the United Arab Emirates shows an effeminate gay man being “cured” by two straight men.

The internet also offers a chance to debate the fundamental issue: the Islamic prohibition of homosexuality. This is based on a tale (common to all three Abrahamic religions, though details differ) of a man called Lot and the cities of Sodom and Gomorrah. These were engulfed in fire and brimstone as divine punishment for the local penchant for gay sex.

Earlier Islamic societies were less hardline. An 11th-century Persian ruler advised his son to alternate his partners seasonally: young men in the summer and women in the winter. Many of the love poems of the eighth-century Abu Nuwas in Baghdad, and of other Persian and Urdu poets, were addressed to boys. In medieval mystic writings, particularly Sufi texts, it is unclear whether the beloved being addressed is a teenage boy or God, providing a quasi-religious sanction for relationships between men and boys. Austere European chroniclers fumed at the indulgent attitudes to gay sex in the Caliphs' courts (now the censure is the other way).

Like liberal Jewish and Christian scholars in recent decades, some Muslim thinkers are now finding theological latitude. “The Koran does not condemn homosexuality,” says Scott Siraj al-Haqq Kugle, an American Muslim convert who teaches Islamic studies at Emory University in Atlanta. The story of Lot, he argues, deals with male rape and violence, not homosexuality in general. Classical Islamic theologians and jurists were mostly concerned with stifling lustful immorality, he says. Koranic verses describe without condemnation men who have no sexual desire for women.

Arash Naraghi, an Iranian academic at Moravian College in Pennsylvania, suggests that the verses decrying homosexuality, like those referring to slavery and Ptolemaic cosmology, stem from common beliefs at the time of writing, and should be re-examined. Even Sheikh Muhammad Hussein Fadlallah, the late spiritual leader of Lebanon's Hizbullah party-cum-militia, conceded that more research is needed in order to understand homosexuality.

Unsurprisingly, the debate, such as it is, is led by gay Muslims outside the Islamic world. Though their rights are better protected, they too can suffer from intolerance—as the trial in Derby last month highlighted. In European cities with lots of poor, pious Muslim immigrants, municipal politics brings some rum alliances. Ken Livingstone, a left-wing London politician with a strong record on gay rights, has in the past welcomed Yusuf al-Qaradawi, an America-bashing Muslim cleric from Egypt who supports the death penalty for homosexuality.

In Muslim countries activists have mostly shied away from the pitfalls of theological debate. Instead, groups such as Helem, a Lebanese NGO, use the secular language of human rights, citing United Nations declarations. Mr Alizadeh sees progress, though it is slow. Even some Muslim clerics, the group most resistant to reform, are shifting slightly. After attacks on gay men in Iraq in 2009, Muqtada al-Sadr, a fiery Shia cleric, condemned the killings. He said that the “depravity” of homosexuality should indeed be eradicated, but through “preaching and guidance” rather than violence. Optimists would see that as progress, of a sort.