BEIRUT (AP) - The gunman who attacked a gay nightclub in Orlando is said to have pledged allegiance to the Islamic State in a 911 call, and on Monday the extremist group described the shooter as "one of the soldiers of the caliphate in America."
Here's a look at what the Islamic State group, 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 Quran, 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 Quran says, but it doesn't say how - and it adds that they should be left alone if they repent.
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.
Yet, despite that teaching, Muslims in some countries have indicated support for LGBT rights. Just over 40 percent of U.S. Muslims said they supported same-sex marriage last year, in a survey by the Washington-based Public Religion Research Institute.
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 just beginning and is not widely accepted.
WHAT DOES THE ISLAMIC STATE GROUP SAY?
According to the Islamic State group's 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, the Islamic State group 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 IS, 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 criminalize 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 IS. In Syria, al-Qaida's local branch as well as other Islamic insurgent groups battling IS, 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."