Just after it became known in June that the attacker of Orlando's Pulse nightclub had pledged allegiance to ISIS, Egypt's foreign ministry immediately moved to condemn the attack on a U.S. gay bar.
"Egypt stands next to the American people in these difficult times, offering sincere condolences to the families of the victims and wishing the injured a speedy recovery," the ministry said.
Yet the statement didn't acknowledge that Pulse was a gay club, and that many of the victims were members of the LGBTQ community.
Three days later, a court in Cairo sentenced two 18-year-olds to three years in prison on charges of "debauchery": The young men were apprehended through government surveillance of social media dating apps for gay men, according to court records.
It's no surprise to gay Egyptians, say community leaders. In fact, they say Egypt has become one of the world's biggest jailers of gay men, with as many as 500 behind bars on "morals" charges — and the crackdown is escalating.
"Most of the gay people in Egypt are even not out to their families — they are living in fear, not living their lives," said Yousef Rizik, who at 18 is one of Egypt's youngest gay leaders and among the few willing to speak openly about the wave of repression against the community.
"If you have money and you are just being secretly gay and not an activist, then you are fine but if you are poor with no connections and openly gay, then you are definitely in prison," he added.
Activists say the current wave of arrests started in October 2015, as Egyptian security services extended their crackdown from Islamist groups to civil society organizations.
The situation is being echoed in a number of countries in the region, they add.
"Egypt, Saudi Arabia, Qatar, UAE, Bahrain, and Kuwait have all rushed to condemn the crime in Orlando labeling it terrorism while insisting Islam has nothing to do with it," said a spokesman for Mesahat, an LGBT service organization operating in Egypt and Sudan.
"These same governments keep arresting and torturing gay people and are putting them in jail. Meanwhile they are sponsoring a religious discourse that feeds homophobia."
A new phenomenon
The Quran mentions homosexuality only once, in a retelling of the biblical story of Sodom and Gomorrah.
But gay people in the region say widespread condemnation of homosexuality came about only in the 1980s, when the rise of the global LGBT rights movement coincided with the expansion of ultraconservative Wahhabism sponsored by Saudi Arabia.
Activities and relationships that were considered normal 30 years ago are now described as haram, an Islamic term to describe religiously prohibited behavior like eating pork or consuming alcohol. Homosexuality is now frequently condemned as a "Western" vice and a threat to Arab and Islamic culture.
"Wahhabi attitudes spread to Egypt and took over a more enlightened, liberated Islam," said Ahmed Hafez, an Egyptian analyst with the Human Rights Campaign, a Washington, D.C.-based LGBT advocacy group.
"Now the police in Egypt are targeting gay people to show the public that they are on the side of morality and are doing a good job in fighting debauchery, as a distraction to hide their failures in the crackdown on terrorism or drug trafficking," he added.
"Day after day, we read about how the Islamic State, militias and extremists handle the LGBT community in countries like Syria, Iraq, Yemen, and Morocco," said Khalid Abdel-Hadi, 27, publisher of My Kali, the only LGBT magazine in the Middle East.
"[We often see] videos of LGBT individuals being thrown from tall buildings, head first, and then stoned by bystanders." In mid-August, ISIS released a video of a man accused of "homosexual acts" and "corruption of thought" being pushed off the roof of a tall building.
In Jordan, too, local rights groups say ISIS has killed people for being gay. The country has no formal groups responsible for protecting LGBT rights.
"LGBT people still often cannot report or seek redress for discrimination or criminal acts against them, given the social stigma," said Adam Coogle, a researcher for Human Rights Watch in Amman.
But an Amman restaurateur who works on HIV awareness among Syrian refugees in Jordan's Zatari Camp said "it's not the right time for advancing gay rights here." He asked that his name be withheld for safety reasons.
"The Ministry of Social Development turned down our request to register a LGBT social service organization last year, but after Orlando, I'm more concerned about a lone wolf attack by Daesh against the few places where we can openly socialize," he said, using an Arabic acronym for ISIS.
Coogle says the situation for LGBT people in Jordan is still better than in other Middle East countries.
Meanwhile in countries like Egypt and the Gulf states, safe spaces are limited to discreet hotel bars catering mostly to foreigners, and small gatherings in wealthy private homes.
Online entrapment by the authorities is also a pervasive worry in Egypt, Syria and Palestine.
The exception that proves the rule
Despite its political instability, Beirut, Lebanon, may be the one Arab capital where LGBT people are increasingly comfortable and safe.
"We even have a 'straight-friendly' gay bar in Beirut," joked 32-year-old Georges Azzii, co-founder of Helem, a Lebanese nonprofit organization advocating for the LGBT community. "But it was empty for the first few days after Orlando."
Lebanon does not explicitly outlaw homosexuality, but article 534 of Lebanon's penal code punishes "any sexual intercourse contrary to the order of nature" with up to one year in prison.
The law does not specify what might constitute "contrary to the order of nature," leaving a large margin of interpretation to individual judges. The provision has been used mainly to prosecute people suspected of homosexuality.
Azzi says four court rulings over the past few years have restricted the use of these laws against Lebanese gays, although the police and security forces still punish those perceived to be gay or transgender.
"Even with the advancements in the law and increasingly supportive media," he says, "people in the community are now on edge."
This story was reported from Cairo, Egypt.
This article, by Jacob Wirtschafter, originally appeared at GlobalPost.