Who’d have guessed that 2013 would be the year in which Aaron Sorkin would come to the rescue of Islam? To clarify: the creator of The West Wing hasn’t converted and become a Muslim. He probably doesn’t have a clue how significant his (inadvertent) contribution has been to the struggle against Islamophobia – and that, too, in the mother of parliaments.

Let me explain. In a debate in the House of Lords on 19 November, the former leader of Ukip Lord Pearson asked why the Prime Minister had refused to blame Islam for acts of terrorism. Doing his best impression of Darth Vader, Pearson said, “I fear the dark side is moving strongly within Islam,” and cited various blood-curdling verses from the Quran.

The government’s response to his hate-mongering comments came from Baroness Warsi, the Muslim Tory peer and minister for faith and communities. Warsi decided to address Pearson’s bigotry by quoting from a West Wing episode from 2000.

In the show, President Jed Bartlet takes on a Christian evangelical radio presenter who had called homosexuality an “abomination”. “I don’t say homosexuality is an abomination, Mr President. The Bible does,” she replies, citing Leviticus 18:22. To which Bartlet responds:

“I wanted to ask you a couple of questions while I had you here. I’m interested in selling my youngest daughter into slavery as sanctioned in Exodus 21:7 . . . What would a good price for her be? . . . My chief of staff, Leo McGarry, insists on working on the Sabbath. Exodus 35:2 clearly says he should be put to death. Am I morally obligated to kill him myself, or is it OK to call the police? . . . Does the whole town really have to be together to stone my brother John for planting different crops side by side? Can I burn my mother in a small family gathering for wearing garments made from two different threads? Think about those questions, would you?”

It was the perfect riposte from Warsi, who went on to point out to Pearson that “texts from the Old Testament” can also “easily be manipulated to cause mischief”. Being a person of faith, she added, requires understanding of not just the values but “the context in which that faith was formed. To be an adherent, one must also be a historian.”

Rigid, context-free literalism is the bane of every religion, not just of Islam. Consider for a moment the growing numbers of evangelical Christians who reject evolution on the basis of Adam and Eve or claim the earth is 6,000, rather than 4.54 billion, years old, simply because the Old Testament says so. Or Orthodox Jews who treat the Torah as a property deed for the West Bank. How about those Hindus who fall back on the Vedic texts to justify the caste system?

As the historian Karen Armstrong and countless other scholars of religion have argued, every major faith has been plagued by the distorting and reactionary effects of literalism, puritanism and fundamentalism at some stage in recent history. Still, it would be disingenuous of me to deny that, these days, Muslims are more prone to literalist interpretations of their holy scripture than most other believers; to views that are dogmatic, belli­gerent and blind to nuance. Such Muslims, I hasten to add, are still in the minority but the religious establishments in countries such as Pakistan, Iran and in particular Saudi Arabia – which has pumped millions (billions?) of dollars into exporting its ultra-austere Wahhabi brand of Islam – haven’t helped.

However, a Muslim-majority nation such as Saudi Arabia, doesn’t represent the majority of Muslims – contrary to a bizarre claim made by the National Secular Society’s Anne Marie Waters in a debate on Islam at the Oxford Union that I spoke at in May.

As I explained to Waters in Oxford, both the Islamophobes and the Islamists are guilty of a literal reading of the Quran. Violent extremists such as Osama Bin Laden take the same line as “new atheists” and far-right bigots; that is, both sides believe there is only a single, monolithic Islam that embraces violence, despotism and gender inequality. Stuck in the middle of these two extremes are most of the world’s Muslims, who, according to polling by the Pew Research Centre, want to keep their heads down, have quiet lives and look after their kids.

Most Muslims I know believe that the Quran is the literal, unchanged, divine word of God but don’t believe that mere mortals have the God-given right to apply their own absolute, final say on the meaning of Quranic verses. Throughout Islamic history, interpretations (tafsir) have differed from scholar to scholar and this intra-Islamic pluralism and diversity of thought should be celebrated, not condemned or ignored.

Our very human, fallible and non-divine ability to interpret the Quran is “both a blessing and a burden”, Khaled Abou El Fadl, the liberal Muslim scholar and law professor at the University of California, wrote in a remarkable essay in the Boston Review in December 2001.

“It is a blessing,” he noted, “because it provides us with the flexibility to adapt texts to changing circumstances. It is a burden because the reader must take responsibility for the normative values he or she brings to the text.”

Abou El Fadl provocatively concludes: “The meaning of the text is often only as moral as its reader. If the reader is intolerant, hateful, or oppressive, so will be the interpretation of the text.”

Or, in other words, don’t judge the Quran or, indeed, Islam on the basis of a tiny minority of hate-filled Muslims who project their own intolerance on to the Quran.

Oh, and listen to Aaron Sorkin.

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