Days after Omar Mateen went on a shooting spree inside a gay nightclub in the United States on Sunday, killing at least 49 people, clues to his possible motivations are emerging.

Mateen had boasted of links to the Islamic State, Al-Qaeda as well as Hezbollah. While all three groups are well-known West Asian insurgents, they are also at war with one another and represent widely differing theological views. US investigators said that Mateen did not seem to understand the distinction between the groups – a point that makes it difficult to square with the charge of Islamist terror that was considered in the immediate aftermath of the attack.

Mateen was killed by the police on Sunday after he opened fire at Pulse, a gay nightclub in Orlando, in a tragedy that was among the deadliest mass shootings in American history.

The 29-year-old was reportedly a regular at Pulse and even used a gay dating app. Reports of him having asked men out have surfaced over the last few days, with his ex-wife claiming she believed he was gay. She also said that Mateen’s father, an immigrant from Afghanistan, had mocked him for his sexual orientation. One of the first statements made by Mateen’s father after the shooting was, in fact, that homosexuals can be punished by God.

Stigmatising homosexuality

Could the attack, then, have been driven by Mateen’s sexual orientation and the shame associated with homosexuality amongst Muslims today – rather than Islamist terror? “Transgressive sexuality and conservative religion can be a toxic mix,” writes David Shariatmadari in the Guardian. “If Mateen felt conflicted about his interest in gay men, it could have been because he believed his faith would condemn him for it”.

While a clear motive is yet to be established, it is a fact that modern Muslim societies condemn and shame homosexuality. In most Islamic countries, Muslims cannot come out as gay without risking stigma and bodily harm.

It is, however, important to point out how recent this homophobia is. For much of history, Muslim societies have been incredibly permissive of same-sex love.

Golden Age

At the height of the Islamic Golden Age – a period from the mid-8th century to the mid-13th century when Islamic civilisation is believed to have reached its intellectual and cultural zenith – homosexuality was openly spoken and written about. Abu Nuwas (756-814), one of the great Arab classical poets during the time of the Abbasid Caliphate, wrote publicly about his homosexual desires and relations. His homoerotic poetry was openly circulated right up until the 20th century.

Nuwas was an important historical figure – he even made a couple of appearances in The Book of One Thousand and One Nights (known in Urdu as Alif Laila). It was only as late as 2001 that Arabs started to blush at Nuwas’ homoerotism. In 2001, the Egyptian Ministry of Culture, under pressure from Islamic fundamentalists, burnt 6,000 volumes of his poetry.

Most modern Muslims, therefore, have little knowledge of what the Islamic Golden Age was really about, even though they keep on wanting to go back to it.

“ISIS have no idea what restoring the Caliphate actually means,” a tweet by Belgian-Egyptian journalist Khaled Diab said. “In Baghdad, it’d involve booze, odes to wine, science... and a gay court poet.”

Baghdad was, till the time the Mongols invaded and destroyed it, the cultural capital of much of the world – the New York City of its time. If Nuwas and his homoerotic poetry could represent the height of Baghdadi culture, it is natural that other Muslim societies would also be quite open to homosexuality. As historian Saleem Kidwai puts in the fabulous book Same-Sex Love in India, “Homoerotically inclined men are continuously visible in Muslim medieval histories and are generally described without pejorative comment.”

Writing on same-sex love

In fact, far from being pejorative, Muslim societies once openly spoke of same-sex love, even celebrating it at times. Mahmud of Ghazni, a towering sultan of his time (971-1030), was actually held up as an ideal for, among other things, deeply loving another man, Malik Ayaz.

Mughal Emperor Babur wrote of his attraction to a boy in the camp bazaar in his 16th-century autobiography – a celebrated work of literature in the medieval Muslim world.

In the 18th century, Dargah Quli Khan, a nobleman from the Deccan travelling to Delhi, wrote a fascinating account of the city called the Muraqqa-e-Dehli (The Delhi Album), which described just how mundane homosexuality was in Indo-Islamic society. At the public bazaars, male prostitutes solicited openly and Khan spoke admiringly of how “young good-looking men danced everywhere and created great excitement”.

Till the 19th century, Muslims treated homosexuality as a part and parcel of life, so much so that students were exposed to romantic stories of homosexual love – a position untenable even today across parts of the Western word. Kidwai writes:

Sadi’s classic Gulistan, containing stories of attraction between men, was considered essential reading for Persian students. Ghanimat’s Nau rang-i ishq, a seventeenth century masnavi describing the love affair between the poet’s patron’s son and his beloved Shahid, was a prescribed text in schools.

Islamic law

Of course, theologically, Islam did consider homosexuality to be sinful, based on the Quranic story of the people of Lut (Lot in the Bible). Interestingly, though, the Shariat, the umbrella term for the various legal codes and schools governing Muslim societies, have no punishment for homosexualty per se – sexual relations between men are outlawed under the larger rubric of adultery. Even then, convictions for homosexuality could only be carried out if the sexual act was testified to by four eye witnesses. This was such a high bar that commentators on Islam such as Hamza Yusuf have characterised the outlawing of homosexuality in the Shariat as a sort of “legal fiction”. Indeed, unlike medieval Europe, instances of homosexuals being punished are rare in medieval Muslim societies.

So what caused Muslim societies to go from coolly reading homoerotic poetry to outlawing and stigmatising same-sex love? It’s tough to nail down an exact reason but here’s an interesting coincidence: there are five Muslims countries where being gay isn’t a crime. All that the five – Mali, Jordan, Indonesia, Turkey and Albania – share in common is that they were never colonised by the British.

Colonial influence

In 1858, in fact, the Ottoman Empire decriminalised homosexuality (a status inherited by Turkey). This was two years before the British Raj created the Indian Penal Code, Section 377 of which proceeded to outlaw homosexuality in modern-day India, Pakistan and Bangladesh.

So deep was the influence of the 1860 penal code in India that conservative Hindus continue to hold homosexuality to be immoral and in the nearly 70 years since Independence, Parliament has not been able to overturn the law. Subramanian Swamy, Member of Parliament from the right-wing Bharatiya Janata Party even went so far as to claim: “Our party position has been that homosexuality is a genetic disorder.” This is near-bizarre given that Hinduism, unlike Islam or Christianity, does not even have any textual condemnation of same-sex love.

It appears as though Muslim (and Hindu) conservatives, without knowing it, are actually copying the Victorian mores of 19th century colonialism, while ignoring their own history. This at a time when even Western European cultures have pulled up their socks and gone on to ensure that human rights are available to their people irrespective of random externalities such as the gender they happen to be attracted to.

Note: an earlier version of this article incorrectly mentioned that Mali, Jordon, Indonesia, Turkey and Albania were never colonised rather than the fact that they were never colonised by the British. The error has been rectified.