“Medieval jurists were unable to achieve a consensus. There is no specific punishment prescribed, however, and this is usually left to the discretion of the local authorities on Islam.Mohamed El-Moctar El-Shinqiti, a contemporary Mauritanian scholar, has argued that "[even though] homosexuality is a grievous sin...[a] no legal punishment is stated in the Qur'an for homosexuality...[b] it is not reported that Prophet Muhammad has punished somebody for committing homosexuality...[c] there is no authentic hadith reported from the Prophet prescribing a punishment for the homosexuals..." Hadith scholars such as Al-Bukhari, Yahya ibn Ma'in, Al-Nasa'i, Ibn Hazm, Al-Tirmidhi, and others have impugned these statements.Same-sex sexual intercourse is legal in 20 Muslim-majority nations (Albania, Azerbaijan, Bahrain, Bosnia and Herzegovina, Burkina Faso, Chad, Djibouti, Guinea-Bissau, Lebanon, Tunisia, Iraq, Jordan, Kazakhstan, Kosovo, Kyrgyzstan, Mali, Niger, Tajikistan, Turkey, West Bank (State of Palestine), and most of Indonesia (except in Aceh and South Sumatra provinces, where bylaws against LGBT rights have been passed), as well as Northern Cyprus.
Abu `Isa Muhammad ibn `Isa at-Tirmidhi compiling the Sunan al-Tirmidhi around C.
E.884 (two centuries after the death of Muhammad) wrote that Muhammad had prescribed the death penalty for both the active and also the passive partner: Ibn al-Jawzi (1114-1200) writing in the 12th century claimed that Muhammad had cursed "sodomites" in several hadith, and had recommended the death penalty for both the active and passive partners in homosexual acts.
Kutty, who teaches comparative law and legal reasoning, also wrote that many Islamic scholars have "even argued that homosexual tendencies themselves were not haram [prohibited] but had to be suppressed for the public good".
He claimed that this may not be "what the LGBTQ community wants to hear", but that, "it reveals that even classical Islamic jurists struggled with this issue and had a more sophisticated attitude than many contemporary Muslims".
Extreme prejudice remains, both socially and legally, in much of the Islamic world against people who engage in homosexual acts.
In Afghanistan, Brunei, Iran, Iraq, Mauritania, Nigeria, Saudi Arabia, Sudan, United Arab Emirates and Yemen, homosexual activity carries the death penalty.Comparisons have been made between the imperative nature of the secrecy of homosexual acts and the secrecy of women in many Islamic societies.In other words, women have to live under a certain amount of secrecy (whether that means being veiled or otherwise), and homosexuals must keep all of their transgressions and acts a secret.Most surely you come to males in lust besides females; nay you are an extravagant people.And the answer of his people was no other than that they said: Turn them out of your town, surely they are a people who seek to purify (themselves).Outside of the Quran, there were varying opinions on how the death penalty was to be carried out for such sexual transgressions.