Here’s something you may not have thought likely. A majority of American Muslims now believes that it’s fine to be gay. The latest Pew Research Centre survey, published on 26 July, tells us that most think homosexuality “should be accepted by society”. The poll further shows how dramatically acceptance has risen, nearly doubling from 27% to 52% since 2007 (among millennial Muslims, it’s 60%). Muslims may lag behind the general public, for whom the corresponding figure on this issue is 63%, but they poll at exactly the same percentage as Protestants and far above white evangelical Christians, a mere 34% of whom believe that homosexuality should be tolerated.

If you have actually spent some time with American Muslims you won’t be surprised by these numbers. I’m not. This is a multifaceted group of people, representing many different and sometimes conflicting tendencies and traditions. But the Pew data shows us that the overall tilt of the community, even while it is itself contending with high levels of discrimination, is progressive and optimistic.

The idea that Muslims represent a civilisational threat to the west is so widespread that it is seen as a truism

You’d never know it if you listened to populist leaders. Whether in the US, the UK, or on the European continent, the idea that Muslims represent a civilisational threat to the west because of an intrinsic ultra-conservatism, which includes a violent hatred of gay people, is so widespread that it is seen as a truism. Not only is this tidy titbit of political wisdom false, it also ends up obscuring the degree of homophobia in other parts of society, and in our politics.

Rightwing populism is especially devoted to this narrative. From Donald Trump to the Netherlands’ Geert Wilders, France’s Marine Le Pen and Ukip’s Anne Marie Waters, today’s demagogues seek to convince the public that they are the true defenders of freedom, courting LGBT votes by dangling the caricature of a dangerous, intolerant and homophobic Muslim in front of their eyes. But this apparent support for LGBT rights is often only skin-deep.

During the US presidential campaign, Trump frequently argued that he was the best candidate for LGBT voters because Hillary Clinton was soft on Muslim immigration. At the Republican convention, Trump stated: “As your president, I will do everything in my power to protect our LGBT citizens from the violence and oppression of a hateful foreign ideology.” Now Trump is proposing to ban all transgender people from serving in the military.

During the French presidential election Marine Le Pen surrounded herself with gay advisers and claimed that she alone would protect LGBT people from the Muslim menace. “France isn’t burkinis on the beach. France is Brigitte Bardot,” she said, and claimed during a televised debate that Emmanuel Macron was supported by a French Muslim organisation that sponsored speakers who hated Jews and homosexuals. (“I think it’s terrific to see you speak words in defence of homosexuals and Jews,” Macron cleverly responded.) But Le Pen also opposed gay marriage (and, just in case you wondered, not from a principled point of criticism of the bourgeois roots of marriage), legal in France only since 2013. The fact is, she is not a true defender of LGBT rights, just an opportunist.

Geert Wilders’ animosity towards all things Muslim is so over the top that it appears to be turning his hair peroxide-blond. (It has been reported that he dyes his hair because his original dark curls drew racist jeers as a child.) “Day after day, for years, we are experiencing the decay of our cherished values,” he said in January. “The equality of men and women, freedom of opinion and speech, tolerance of homosexuality – all this is in retreat.” Again, it’s hard not to conclude that the greatest threat to the Dutch tradition of tolerance isn’t Islam – but people such as Wilders. The good news is that neither he nor Le Pen succeeded in their campaigns.

Facebook Twitter Pinterest Ukip leadership candidate Anne Marie Waters at an anti-Islam protest in London last year. Photograph: Vickie Flores/REX/Shutterstock

But now a bid for the leadership of Ukip is under way by none other than Waters, founder of Sharia Watch UK. Her manifesto demands the party “publicly acknowledge that Islamic culture is simply not compatible with our own”. She’s been quoted as saying that sharia law “has terrible elements to it in terms of treatment of women, antisemitism and homophobia”. And yet it was Roger Helmer, one of Ukip’s leading lights, who once asked: “Why is it OK for a surgeon to perform a sex-change operation, but not OK for a psychiatrist to try to ‘turn’ a consenting homosexual?” He is also said to believe there are that there are different “degrees of culpability” in rape cases.

Oh, the brave men and women of the right. Ever ready to proclaim the threat of Muslim homophobia, they cynically depend on incorporating LGBT concerns into their divisive narratives without in fact providing them full rights of inclusion.

Last month in Germany, for example, lawmakers voted to approve gay marriage (and adoption) in a historic vote. The anti-Muslim populist party Alternative for Germany opposed the measure on ideological grounds, while all six Muslim members of parliament voted in support of the bill. Incidentally, Chancellor Angela Merkel, now widely seen as the pre-eminent guardian of western liberal values, voted against the bill.

Bigot who would lead Ukip is a product of our times | Nick Cohen Read more

The underlying point here is not that Muslims aren’t homophobic. Some clearly are. Some undoubtedly aren’t. Rather, the crucial point – borne out by the Pew data – is that positions can change over time.

In the UK, Muslims are still dealing with fallout from a Channel 4 documentary – What British Muslims Really Think – that purported to show how different they were from other Britons. It included the statistic that 52% of UK Muslims believe homosexuality should be illegal, which is shocking in isolation. It’s a different metric, but consider this: in 1985, only 9% of British Catholics believed that same-sex relationships were not wrong. By 2016, that had leapt to 62%. Catholic doctrine had not changed in the interim; attitudes had.

How such change happens is what we should pay attention to. Last year, Omar Mateen killed 49 people in a horrific attack on a gay nightclub he had previously been a patron of in Florida. Sincere discussions have since begun between LGBT and Muslim communities in the US, with spaces also opening up for LGBT Muslims themselves.

Imams and scholars issued a statement condemning the attack and, while falling short of full acceptance of gay Muslims, underlined “the liberty to pursue happiness as each sees fit”. Muslim LGBT groups, such as the Muslim Alliance for Sexual and Gender Diversity, have grown in prominence. Philanthropic organisations such as the Contigo Fund are backing initiatives that unite LGBT, Latin and Muslim communities to battle homophobia, transphobia, Islamophobia and other forms of discrimination.

The health of any society is premised on its ability to face its fissures squarely, but that is not what anti-Muslim populists are doing. By arguing that Islam and the west are forever incompatible, they construct a Muslim bogeyman while denying both their own homophobia as well as the living, breathing Muslims in their midst.

• Moustafa Bayoumi is an author and a professor of English at City University, New York