Gay entertainment mogul Michael Lucas warns of the risks of homophobic Islamist governments forming after the Arab Spring.

After decades in power, a brutal dictator in a Muslim country is dramatically deposed by a massive popular uprising. Sound familiar? Of course: that’s what happened in Egypt and Libya this year, as part of what’s known as the Arab Spring. But it’s also what happened in Iran in 1979 — and that should make us pause for a moment.

It’s easy to cheer for democratic change and celebrate the downfall of tyrants like Egypt’s Hosni Mubarak and Libya’s Muammar Gaddafi. But what if the end of one kind of oppression brings about the rise of another? As history has shown us time and again, revolutions are often turns for the worse.

Gay people should be especially wary when the forces of religious fundamentalism are involved. And nowhere are those forces stronger today than in the Muslim world. The power behind the Arab Spring came in large part from the coiled energy of Islamic groups that had been suppressed by secular dictatorships; as the old regimes crumble, hard-core Islamists are eager to take their place.

If the past is any guide, that’s bad news for gays in the Muslim world. Consider Iran. Under the Shah, Tehran had room for gay nightclubs and artists. That tolerance ended when the ayatollahs took over in the Islamic revolution of 1979 and instituted a fundamentalist form of Quranic law, or Shariah, under which gay sex is punishable by death. (Three Iranian men were hanged for sodomy in September, and hundreds of others have reportedly been executed for gay-related offenses.)

Or consider the explosion of anti-gay violence that followed the end of Saddam Hussein’s secular regime in Iraq. The powerful cleric Ali al-Sistani, who had been kept in check by Saddam, issued a 2005 fatwa calling for gay men and lesbians to be killed “in the worst, most severe way of killing.” In recent years, according to human-rights groups, scores of Iraqi gays have been abducted and murdered — often through gruesome torture and mutilation — by sectarian death squads and even by members of their own families (in so-called “honor killings”).

Iraqi authorities have mostly turned a blind eye to this “sexual cleansing.” Should we be surprised? After all, Shariah is now officially the law of the land. The 2005 Iraqi constitution includes talk about equal rights for all citizens, but its Article 2 calls Islam “the official religion of the State” and says that “no law that contradicts the established provisions of Islam may be established.”

Whether by law (in Iran) or by acceptance of lawlessness (in Iraq), the increased power of Islam in daily life has been a disaster for Muslim gays. Will things be different in the Arab Spring countries?

We have reason to worry. Egypt’s constitution also has an Article 2, which says the same thing as Iraq’s, that “Islam is the religion of the state,” and that “the principal source of legislation is Shariah.” Egyptian voters had the chance to change that language in a March referendum, but they chose to keep it.

Mubarak was no friend to gay Egyptians, and in the past decade his government stepped up its persecution. But as the Egyptian-born LGBT scholar Hassan El Menyawi has pointed out, this policy was largely motivated by Mubarek’s desire to “shore up [his] Islamic credentials” with a radicalized Egyptian population that was happy to see gays targeted.

A Pew Research Center poll last year found that 82 percent of Egyptian Muslims support stoning people who commit adultery, and 84 percent support the death penalty for Muslims who leave the religion. It’s not hard to imagine the same group’s attitudes toward homosexuality. Any government that results from Egypt’s planned 2012 elections is sure to reflect the country’s widespread religious conservatism.

In Libya, as well, the future will almost certainly be less rosy than we’d like. Last month, the world’s jubilation at the death of Gaddafi turned sour when graphic evidence emerged of the mob’s savagery toward the captured leader. (One video shows Gaddafi being sodomized with a stick.) Libyan liberals, and Western ones, were further disturbed a week later when the head of the transitional government suggested that polygamy should be legalized, in line with Shariah.

Optimists say that the practical concerns of democracy — getting elected, building coalitions — will keep radical Islam in check. I think they’re being deeply naïve. The expectations raised by the Arab Spring will be hard to live up to; soon, the new governments will start looking for scapegoats and distractions. Gays have always played those roles too well.

By supporting the revolutions in Egypt and Libya, the West has meddled where it didn’t belong and unleashed the beast of fundamentalism in those countries, just as it did in Iraq. It’s only a matter of time until that beast starts to bite. And when the tyranny of the religious majority starts trampling on sexual minorities — not to mention women and non-Muslims — the world’s pride in the Arab Spring will turn out to have gone before a very long, very hard fall.