ISTANBUL — On June 29, Turkey’s 12th Gay Pride Parade was held on Istanbul’s crowded Istiklal Avenue. Thousands marched joyfully carrying rainbow flags until the police began dispersing them with water cannons. The authorities, as has become their custom since the Gezi Park protests of June 2013, once again decided not to allow a demonstration by secular Turks who don’t fit into their vision of the ideal citizen.

More worrying news came a week later when posters were put up in Ankara with a chilling instruction: “If you see those carrying out the People of Lot’s dirty work, kill the doer and the done!” The “People of Lot” was a religious reference to gays, and the instruction to kill them on sight was attributed to the Prophet Muhammad. The group that put the posters up, the so-called Islamic Defense Youth, defended its message by asserting: “What? Are you offended by the words of our prophet?!”

All of this suggests that both Turkey and the Muslim world need to engage in some soul-searching when it comes to tolerance for their gay compatriots.

Of course this intolerance is not exclusive to either Turks or Muslims. According to the International Lesbian, Gay, Bisexual, Trans and Intersex Association, Turkey scores slightly better on measures of gay rights when compared with some nearby Christian-majority nations such as Russia, Armenia and Ukraine. Indeed, Turkey’s secular laws don’t penalize sexual orientation, and some out-of-the-closet L.G.B.T. icons have long been popular as artists, singers or fashion designers. Among them are two of the most popular Turkish entertainers of the past half-century: The late Zeki Muren was flamboyantly gay and the singer Bulent Ersoy is famously transsexual. Their eccentricity has apparently added to their popularity.