The gunman who attacked a gay nightclub in Orlando is said to have pledged allegiance to Isis (Islamic State) in a 911 call, and yesterday the extremist group described the shooter as "one of the soldiers of the caliphate in America". Here's a look at what Isis, Islamic scholars and others in the region say about homosexuality.
What does Islam say?
Islamic scholars overwhelmingly teach that same-gender sex is a sin.
The Muslim holy book, the Koran, tells the story of Lot and the destruction of Sodom - and sodomy in Arabic is known as "liwat", based on Lot's name.
Men having sex with each other should be punished, the Koran says, but it doesn't say how - and it adds that they should be left alone if they repent.
Yet, despite that teaching, Muslims in some countries have indicated support for LGBT rights. Just over 40 per cent of US Muslims said they supported same-sex marriage last year, in a survey by the Washington-based Public Religion Research Institute.The death penalty instead comes from the Hadith, or accounts of the sayings of the Prophet Muhammad. The accounts differ on the method of killing, and some accounts give lesser penalties in some circumstances.
In addition, a small number of Islamic scholars, mainly in the West, have started re-examining Islamic teaching on same-gender sex and have concluded that the blanket condemnation is a misinterpretation. However, this review is only beginning and is not widely accepted.
According to Isis' radical interpretation of Islam, gays should be thrown from a high building then stoned if they are not dead when they hit the ground. The group bases this gruesome punishment on one account in which the Prophet Muhammad reportedly said gays "should be thrown from tremendous height then stoned". Over the past two years, Isis has thrown dozens of gay men from tall buildings in the areas of Iraq and Syria under its control. The group's online videos show masked militants dangling men over the precipices of buildings by their legs to drop them head-first or tossing them over the edge.
Before Isis, the method was rarely used, though other militants have targeted suspected gays and lesbians for death.
How do other countries in the region treat gays?
Across the Arab world, gays have been arrested and sentenced to prison on charges linked to "debauchery" - and faced flogging, or even the death penalty, in Iran and Saudi Arabia.
During their rule in Afghanistan in the 1990s, the Taliban had their own method: The victim would be placed in a pit and a large stone wall toppled on top of him.
In Egypt, there have been police raids of suspected gay gatherings and people have been put on trial using a vague legal text that equates homosexuality with prostitutes and tries gays for "violating public morality".
"Middle Eastern and North African countries have denounced the Orlando shooting when at the same time they criminalise homosexuality with sentences ranging from years in prison to the death penalty," said Ahmed Benchemsi, communications and advocacy director for the Middle East and North Africa at Human Rights Watch.
"Those governments should repeal laws and abolish practices that persecute people based on their sexual orientation and gender identity."
In contrast to much of the region, Israel is widely tolerant of the LGBT community, and Tel Aviv holds a massive annual gay pride parade. However, last year a radical ultra-Orthodox Jew stabbed a teenage girl to death at a parade in Jerusalem, which is far more conservative.
Religiously mixed Lebanon is the most liberal among Arab nations regarding same-sex relationships, and has an active LGBT community. Still, a Lebanese law forbids homosexuality, although it is rarely enforced and has been challenged in courts.
While homosexuality is not illegal in Afghanistan, gays fear the consequences of disclosing their identities, including police harassment and death threats.
Fear of persecution
Many gays in the conservative Muslim world keep their sexual orientation secret for fear of reprisal by relatives and others. A young Syrian man told the Associated Press last year that he fled Syria after he got scared his father might tell militants about his sexual orientation.
And it's not just Isis. In Syria, al-Qaeda's local branch, al-Nusra Front, as well as other Islamic insurgent groups battling Isis, have also killed gays and some homosexuals have had to flee the country for their own safety.
Rameen, a 30-year-old gay man from Afghanistan, said he keeps his sexuality secret from family and friends. "In Afghanistan, most gay people reject their own identity. They struggle and try to act straight," said Rameen, who gave only his first name for fear of persecution. "I know people who have committed suicide because they could not cope with the reality of their sexuality."