When Omar Mateen, a young American-born man attacked a gay nightclub in Orlando, he chose his target deliberately. The horrific attack left 49 dead and more injured in a community that is already marginalized and regularly faces discrimination in the United States.

Early reports indicated that Mateen declared his allegiance to jihadist groups. Later investigation revealed that he was likely struggling with his own sexuality as he frequented the nightclub and was a user of gay dating apps. To many this may muddy his motives, but only if one doesn’t understand the history of jihadism.

Jihadism is a particular strain of political and social reform that emerges as an anti-colonial movement in the Muslim world. In response to the threat of European hegemony, jihadism resisted violently and through that violence sought to reform the Muslim world.

At the heart of jihadist political violence are specific conceptualizations of gender and sexuality. Jihadism imagines a glorified militant masculinity that protects the Muslim world from the European threat and purifies its societies of internal decay.

Traditionally, Islamic history has been relatively tolerant of sexual diversity, and gay, lesbian, transgender, and intersex individuals occupy quite public spaces in medieval Muslim societies.

The progenitor of the modern Salafist movement, Muhammad ibn ‘Abd al-Wahhab, lived in a world of declining Ottoman power and in the face of growing European imperial might. European visitors to Muslim lands saw the tolerance and diversity of sexual desire as a sign of Islam’s backwardness. To European orientalists, the Muslim world was simultaneously a place of exotic sexual fantasy and desire, as well as a place of sexual perversion.

Orientalist depictions of a languid and hedonistic culture captured the imaginations of Europeans. Works of art like Ingre’s Grande Odalisque depicted concubines in pleasure houses. Travel accounts like that of CS Sonnini disapprovingly noted, “It is not for women their ditties are composed: it is not on them that tender caresses are lavished; far different objects inflame them.”

According to historian William G. Clarence-Smith, “Many secular Westerners perceived homosexuality as evidence of primitive survivals or biological decay. Such notions influenced modernizing Muslim reformers, seeking to strengthen their country.”

Ibn ‘Abd al-Wahhab linked what he saw as the decline of the Muslim world to sexuality. To him, the sexual diversity that was characteristic of much Islamic history was a sign of decay needing to be expunged. In response to the orientalists’ imaginings of a decadent and sexually perverse Muslim man, Ibn ‘Abd al-Wahhab called for a jihad to purify the Muslim world.

The first jihads by Ibn ‘Abd al-Wahhab’s followers were against the intersex and gay custodians of the holy shrines of Mecca and Medina. For centuries, these guardians had stood watch over the holiest sites of Islam, but to Ibn ‘Abd al-Wahhab and his followers, they were representatives of the social order that had to be violently overturned.

Clarence-Smith goes on to say, “Wahhabi forces thus sought to cleanse the holy places of Mecca and Medina of homosexual activities…Tolerance was no longer acceptable…jihadists were keen to reform the sexual mores of the faithful.”

The first jihad of the modern era was not against the West, but against gay Muslims.

At the center of that jihad was a formulation of militant masculinity. Ibn ‘Abd al-Wahhab’s Salafi followers defined their heterosexuality and indeed, their virility through the oppression of gay men. While lesbian women were also marginalized, gay male sex in particular was deemed subversive to the Salafist.

The Salafist ideology would later inspire the jihadist movements of Al Qaeada and Daesh (ISIS).

In a perverse way, these groups respond to a sense of emasculation. The impotency of the Muslim world in the face of first European colonialism and later American militarism engenders a sense of insecurity which each jihadist group attempts to redress.

Daesh’s use of sexual slavery and execution of gay Muslims is not a remnant of medieval Islam, but a modern expression of anti-colonial violence enmeshed with jihadist rhetoric glorifying a militant masculinity that reimagines Islamic history, erasing the diversity, complexity, and tolerance in favor of a rigid political application intended to reclaim some perceived sense of past potency.

Daesh’s propaganda unveils their sexual anxiety. Images of Daesh fighters posed in heroic screenshots, mirroring superheroes and video game characters are telling. Daesh fighters are depicted as hyper-masculine, capable, and violent.

In many ways, this type of masculinity is not unique to the Muslim world. Only those ignorant of history can ignore the way the 2nd Amendment has been racialized; the right to bear arms is often the right to bear arms against immigrants and people of color.

Trump’s call to “make America great again” plays to the same ideas of a lost masculine potency that can be regained through violence and oppression against immigrants, black people, Mexicans, and Muslims.

While American militancy is defined as oppositional to immigrants and people of color, jihadist formulations of masculinity are defined by its exclusion of women and violence against the LGBTQ community. Both are expression of toxic masculinity.

It is tempting to see jihadism as a solely religious expression, but its history is entangled in anti-colonial anxieties that mangled and redefine religious expression deliberately and in opposition to the broader historical arc of the Islamic world. One cannot ignore how Omar Mateen’s homophobic violence contrasts with the valorization of homoeroticism in Rumi. Or how he committed his heinous acts during the month of Ramadan, a holy month of fasting for Muslims and a month that calls upon the faithful to make peace.

That Omar Mateen abused his ex-wife is not coincidental. Violence against sexual minorities goes hand-in-hand with violence against women. If gay individuals became a sign of moral and societal decay that needed to be purified, then women became a symbol of vulnerability that needed to be protected.

The forced veiling of women is a testament to the endeavor of jihadist militant groups to supposedly preserve society. As scholar of gender, Minoo Moallem, notes in her work on fundamentalism in Iran, “The veil signified an Islamic femininity… through an Islamic femininity and a complementary masculinity, reinforcing heteronormativity as central to the practices of citizenship.”

Omar Mateen’s attack against the LGBTQ community is a deliberate action by a man participating in a militant masculinity, a type of jihadism that defines itself in such acts of violence. He imagined himself as part of a brotherhood of jihadis who recognize one another through the regulation of women and subjugation of sexual minorities. It is an insecure definition of masculinity played out in imagination and expressed in horrific violence.

At the heart of jihadism is a both a rejection of Western influence and a simultaneous acceptance of European orientalists’ diagnosis that paints the ubiquitous acceptance of sexual diversity as a sign of Islam’s decay and moral laxity.

To the jihadist the decay of sexual diversity is purified through violence. Omar Mateen’s assault on the LGBTQ community fits into a history of jihadism that redefines sexual mores vis-à-vis violence.

The greatest threat to this violence, is the reminder of the sexual diversity present throughout the history of Islam.