Attitudes toward lesbian, gay, bisexual, and transgender (LGBT) people and their experiences in the Muslim world have been influenced by its religious, legal, social, political, and cultural history. The Quran narrates the story of the "people of Lot" destroyed by the wrath of God because the men engaged in lustful carnal acts between themselves, but modern Western historians have concluded that the Islamic prophet Muhammad never forbade homosexual relationships outright, although he disapproved of them in line with his contemporaries. At the same time, "both the Quran and the hadith strongly condemn homosexual activity"; with some hadith prescribing the death penalty for those engaged in male homosexual or lesbian intercourse publicly.
There is little evidence of homosexual practice in Islamic societies for the first century and a half of the early history of Islam (7th century CE), although male homosexual relationships were known and discriminated, but not sanctioned, in Arabia. Homosexual acts were legally forbidden in traditional Islamic jurisprudence and subject to punishment, including flogging, stoning, and the death penalty, depending on the situation and legal school. At the same time, homosexual relationships were in practice generally tolerated in pre-modern Islamic societies, and historical records suggest that laws against homosexuality were invoked infrequently, and mainly in cases of rape or other "exceptionally blatant infringement on public morals". Homoerotic and pederastic themes were cultivated in poetry and other literary genres written in major languages of the Muslim world from the 8th century CE into the modern era. The conceptions of homosexuality found in classical Islamic texts resemble the traditions of Greco-Roman antiquity rather than the modern understanding of sexual orientation.
In the modern era, public attitudes toward homosexuality in the Muslim world underwent a marked change starting from the 19th century due to the global spread of Islamic fundamentalist movements such as Salafism and Wahhabism.