The ISIS-inspired massacre at a gay nightclub in Florida has brought to light a longstanding practice among practitioners of radical Islam not always observed in the West: its violent persecution of the LGBT community.

With homosexuality forbidden in nearly every modern Muslim-majority country—and carrying a death sentence in some—Islamist militants have for many years taken cruel punishments exacted against gay people to new extremes. Before Omar Mateen shot more than 100 people in Orlando, the Islamic State routinely made a spectacle of throwing supposedly gay people from the rooftops of buildings in Syria and Iraq. Shiite militias roamed the streets of Baghdad in search of gay men and boys to brutalize at the height of sectarian bloodshed there. This spring, al-Qaeda sympathizers hacked a pair of LGBT activists to pieces in Bangladesh.

This time, the target was in the West, where gay communities enjoy greater—if still not equal—protection under the law.

While a precise motive behind Mateen’s attack is unclear, those who knew the suspected gunman say his antipathy toward the gay community ran deep. His ex-wife told the New York Times that Mateen, a practicing Muslim, would make anti-gay comments when he was angry. Claiming that the attack had “nothing to do with religion,” his father, Sediqque Mir Mateen, told NBC News his son recently was infuriated at the sight of two men kissing in public.

Armed with a pistol and AR-15-style assault rifle, the 29-year-old walked into the Pulse nightclub around 2 a.m. on Sunday and opened fire. At least 49 people were killed and more than 50 others injured in what’s being called the worst mass shooting in U.S. history. Law enforcement officials said Mateen pledged allegiance to the Islamic State before he was eventually killed by police. Officials said on Monday there was no clear evidence the shooter was directed by ISIS or part of a larger terror plot.

ISIS nevertheless wasted little time in claiming credit for the attack, and some supporters highlighted that “deviant” homosexuals were targeted. The Sunni extremist group has previously punished gay men in Iraq and Syria by hurling them blindfolded from buildings or stoning them to death, in horrific scenes captured on film and circulated widely on social media. The group’s violence toward LGBT people became the subject of a United Nations Security Council meeting last summer.

Leading ISIS experts say that the group’s anti-gay stance is not the core of what drives its ideology. Charlie Winter, a senior researcher at Georgia University’s Transcultural Conflict and Violence Initiative, told Vocativ that the jihadists’ contempt for what it views as moral corruption can make just about any place a so-called soft target, whether that’s a music venue in Paris, a Tunisian beach resort or a gay nightclub in Florida.

“The message seems to be that any crusader is a good target for the Islamic State,” Winter said.

Nor is ISIS the only Islamist group to commit barbaric acts against gay people. Members of al-Nusra front, Syria’s al-Qaeda affiliate and a fierce rival of the Islamic State, has reportedly tortured people for being gay. In April, an al-Qaeda affiliate in Bangladesh claimed credit for butchering a pair of LGBT activists to death in the country’s capital, a crime that drew international headlines.

More Saudi Arabia Considers Executing LGBT People Who Come Out Online

Anti-gay attacks are also not limited to Sunni extremist groups like ISIS and al-Qaeda. Widespread massacres of gay people by Iraq’s Shia militias have been documented for years. The bodies of some victims, including boys and young men, have been found riddled with bullet holes and the word “pervert” scrawled across them, the New York Times reported.

A deep-rooted intolerance toward gays, lesbians, bisexuals and transgender people remains pervasive throughout much of the Muslim world. Viewing homosexual acts as a perversion incompatible with sharia law, most majority-Muslim countries have criminalized them. A handful of nations, including Saudi Arabia and Iran, the Sunni and Shia superpowers of the Middle East, can impose the death penalty on individuals convicted of having gay intercourse. In March, Saudi media published reports that the kingdom was considering executing members of the LGBT community caught coming out on social media.

In some cases, it appears that the ingrained persecution of gays by some countries may have provided a template for ISIS’ own horrific punishments against LGBT people. Reports show that public school textbooks published by Saudi Arabia include debates on how best to execute gay men: whether by stoning, fire, or throwing them off of a high place, as Middle East scholar David Weinberg wrote last year.

But those attitudes aren’t restricted to Muslim-majority countries either. A recent poll in Great Britain found that half the Muslim population there said homosexuality should be against the law.