’Tis the season of apologies – specifically, grovelling apologies by some of our finest academic brains for homophobic remarks they’ve made in public. The Cambridge University theologian Dr Tim Winter, one of the UK’s leading Islamic scholars, apologised on 2 May after footage emerged showing him calling homosexuality the “ultimate inversion” and an “inexplicable aberration”. “The YouTube clip is at least 15 years old, and does not in any way represent my present views . . . we all have our youthful enthusiasms, and we all move on.”

The Harvard historian Professor Niall Ferguson apologised “unreservedly” on 4 May for “stupid” and “insensitive” comments in which he claimed that the economist John Maynard Keynes hadn’t cared about “the long run” because he was gay and had no intention of having any children.

Dare I add my non-academic, non-intellectual voice to the mix? I want to issue my own apology. Because I’ve made some pretty inappropriate comments in the past, too.

You may or may not be surprised to learn that, as a teenager, I was one of those wannabe-macho kids who crudely deployed “gay” as a mark of abuse; you will probably be shocked to discover that shamefully, even in my twenties, I was still making the odd disparaging remark about homosexuality.

It’s now 2013 and I’m 33 years old. My own “youthful enthusiasm” is thankfully, if belatedly, behind me.

What happened? Well, for a start, I grew up. Bigotry and demonisation of difference are usually the hallmark of immature and childish minds. But, if I’m honest, something else happened, too: I acquired a more nuanced understanding of my Islamic faith, a better appreciation of its morals, values and capacity for tolerance.

Before we go any further, a bit of background – I was attacked heavily a few weeks ago by some of my co-religionists for suggesting in these pages that too many Muslims in this country have a “Jewish problem” and that we blithely “ignore the rampant anti-Semitism in our own backyard”.

I hope I won’t provoke the same shrieks of outrage and denial when I say that many Muslims also have a problem, if not with homosexuals, then with homosexuality. In fact, a 2009 poll by Gallup found that British Muslims have zero tolerance towards homosexuality. “None of the 500 British Muslims interviewed believed that homosexual acts were morally acceptable,” the Guardian reported in May that year.

Some more background. Orthodox Islam, like orthodox interpretations of the other Abrahamic faiths, views homosexuality as sinful and usually defines marriage as only ever a heterosexual union.

This isn’t to say that there is no debate on the subject. In April, the Washington Post profiled Daayiee Abdullah, who is believed to be the only publicly gay imam in the west. “[I]f you have any same-sex marriages,” the Post quotes him as saying, “I’m available.” Meanwhile, the gay Muslim scholar Scott Siraj al-Haqq Kugle, who teaches Islamic studies at Emory University in the United States, says that notions such as “gay” or “lesbian” are not mentioned in the Quran. He blames Islam’s hostility towards homosexuality on a misreading of the texts by ultra-conservative mullahs.

And, in his 2011 book Reading the Quran, the British Muslim intellectual and writer Ziauddin Sardar argues that “there is abso­lutely no evidence that the Prophet punished anyone for homosexuality”. Sardar says “the demonisation of homosexuality in Muslim history is based largely on fabricated traditions and the unreconstituted prejudice harboured by most Muslim societies”. He highlights verse 31 of chapter 24 of the Quran, in which “we come across ‘men who have no sexual desire’ who can witness the ‘charms’ of women”. I must add here that Abdullah, Kugle and Sardar are in a tiny minority, as are the members of gay Muslim groups such as Imaan. Most mainstream Muslim scholars – even self-identified progressives and moderates such as Imam Hamza Yusuf in the United States and Professor Tariq Ramadan in the UK – consider homosexuality to be a grave sin. The Quran, after all, explicitly condemns the people of Lot for “approach[ing] males” (26:165) and for “lust[ing] on men in preference to women” (7:81), and describes marriage as an institution that is gender-based and procreative.

What about me? Where do I stand on this? For years I’ve been reluctant to answer questions on the subject. I was afraid of the “homophobe” tag. I didn’t want my gay friends and colleagues to look at me with horror, suspicion or disdain.

So let me be clear: yes, I’m a progressive who supports a secular society in which you don’t impose your faith on others – and in which the government, no matter how big or small, must always stay out of the bedroom. But I am also (to Richard Dawkins’s continuing disappointment) a believing Muslim. And, as a result, I really do struggle with this issue of homosexuality. As a supporter of secularism, I am willing to accept same-sex weddings in a state-sanctioned register office, on grounds of equity. As a believer in Islam, however, I insist that no mosque be forced to hold one against its wishes.

If you’re gay, that doesn’t mean I want to discriminate against you, belittle or bully you, abuse or offend you. Not at all. I don’t want to go back to the dark days of criminalisation and the imprisonment of gay men and women; of Section 28 and legalised discrimination. I’m disgusted by the violent repression and persecution of gay people across the Muslim-majority world.

I cringe as I watch footage of the buffoonish Mahmoud Ahmadinejad claiming: “In Iran, we don’t have homosexuals . . . we do not have this phenomenon.” I feel sick to my stomach when I read accounts of how, in the late 1990s, the Taliban in Afghanistan buried gay men alive and then toppled brick walls on top of them.

Nor is this an issue only in the Middle East and south Asia. In March, a Muslim caller to a radio station in New York stunned the host after suggesting, live on air, that gay Americans should be beheaded in line with “sharia law”. Here in the UK, in February, Muslim MPs who voted in favour of the same-sex marriage bill – such as the shadow justice secretary, Sadiq Khan – faced death threats and accusations of apostasy from a handful of Muslim extremists. And last year, a homophobic campaign launched by puffed-up Islamist gangs in east London featured ludicrous and offensive stickers declaring the area a “gay-free zone”.

I know it might be hard to believe, but Islam is not a religion of violence, hate or intolerance – despite the best efforts of a minority of reactionaries and radicals to argue (and behave) otherwise. Out of the 114 chapters of the Quran, 113 begin by introducing the God of Islam as a God of mercy and compassion. The Prophet Muhammad himself is referred to as “a mercy for all creation”. This mercy applies to everyone, whether heterosexual or homosexual. As Tariq Ramadan has put it: “I may disagree with what you are doing because it’s not in accordance with my belief but I respect who are you are.” He rightly notes that this is “a question of respect and mutual understanding”.

I should also point out here that most British Muslims oppose the persecution of homosexuals. A 2011 poll for the think tank Demos found that fewer than one in four British Muslims disagreed with the statement “I am proud of how Britain treats gay people”.

There is much to be proud of, but still much to be done. Homophobic bullying is rife in our schools. Nine out of ten gay or lesbian teenagers report being bullied at school over their sexual orientation. LGBT teens are two to three times more likely to commit suicide than their heterosexual peers.

Despite the recent slight fall in “sexual orientation hate crimes”, in 2012 there were still 4,252 such crimes in England and Wales, four out of every five of which involved “violence against the person”. In March, for instance, a man was jailed for killing a gay teenager by setting him on fire; the killer scrawled homophobic insults across 18-year-old Steven Simpson’s face, forearm and stomach.

Regular readers will know that I spend much of my time speaking out against Islamophobic bigotry: from the crude stereotyping of Muslims in the media and discrimi­nation against Muslims in the workplace to attacks on Muslim homes, businesses and places of worship.

The truth is that Islamophobia and homophobia have much in common: they are both, in the words of the (gay) journalist Patrick Strudwick, “at least partly fuelled by fear. Fear of the unknown . . .” Muslims and gay people alike are victims of this fear – especially when it translates into hate speech or physical attacks. We need to stand side by side against the bigots and hate-mongers, whether of the Islamist or the far-right variety, rather than turn on one another or allow ourselves to be pitted against each other, “Muslims v gays”.

We must avoid stereotyping and demonising each other at all costs. “The biggest question we have as a society,” says a Muslim MP who prefers to remain anonymous, “is how we accommodate difference.”

Remember also that negative attitudes to homosexuality are not the exclusive preserve of Muslims. In 2010, the British Social Attitudes survey showed that 36 per cent of the public regarded same-sex relations as “always” or “mostly wrong”.

A Muslim MP who voted in favour of the same-sex marriage bill tells me that most of the letters of protest that they received in response were from evangelical Christians, not Muslims. And, of course, it wasn’t a Muslim who took the life of poor Steven Simpson.

Yet ultimately I didn’t set out to write this piece to try to bridge the gap between Islam and homosexuality. I am not a theo­logian. Nor am I writing this in response to the ongoing parliamentary debate about the pros and cons of same-sex marriage. I am not a politician.

I am writing this because I want to live in a society in which all minorities – Jews, Muslims, gay people and others – are protected from violence and abuse, from demonisation and discrimination. And because I want to apologise for any hurt or offence that I may have caused to my gay brothers and lesbian sisters.

And yes, whatever our differences – straight or gay, religious or atheist, male or female – we are all brothers and sisters. As the great Muslim leader of the 7th century and son-in-law of the Prophet Muhammad, Ali ibn Abi Talib, once declared: “Remember that people are of two kinds; they are either your brothers in religion or your brothers in mankind.”

Mehdi Hasan is a contributing writer for the New Statesman and the political director of the Huffington Post UK, where this article is crossposted