Editor's Note: (Muddassar Ahmed is a former adviser to the U.K. government on Muslim communities and a Patron of the Faiths Forum for London. The views expressed are his own.)
(CNN) Sadiq Khan made British political history Friday, becoming the first Muslim to be elected mayor of London. But while his achievement is uplifting, the campaign by his opponents was a dispiriting, sometimes ugly affair.
Khan -- the Labour Party candidate who will succeed Boris Johnson as mayor -- faced a divisive campaign from his main opponent, Zac Goldsmith. The Conservative Party candidate's campaign suggested Khan was a dangerous radical, exploiting racial and cultural stereotypes about Muslims through a dog whistle campaign rooted in subtle racism. Indeed, Goldsmith's recent op-ed in the popular Mail on Sunday newspaper attacking Khan was even, quite inexplicably, accompanied by an image of the 2005 London bombings.
But it is telling that this campaign backfired. Why? Because it shows that the type of aggressive, populist campaign that has so far been successful for Donald Trump in the United States will not necessarily be a blueprint for success elsewhere. Although many on the right in Britain apparently believed that capitalizing on anti-Muslim sentiment is not just acceptable, but a sure ticket to victory, the strategy was found wanting. In short, there is a limit to the ability of bigotry to capture elections.
And it is not just Britain that has demonstrated that resorting to anti-Muslim language can backfire. Take the example of former Canadian Prime Minister Stephen Harper. Last year, he resorted to crude anti-Muslim language as he sought re-election. In contrast, Harper's opponent, Justin Trudeau, went out of his way to embrace Muslims (and other minorities). Harper didn't just lose -- he was trounced.
Why?
Many non-Muslim Canadians were repelled by seeing this faith-based bigotry in their secular politics. Just as importantly, the Muslim-bashing had another effect that Harper apparently did not seem to see coming -- it prompted Canadian Muslims to vote in record numbers. You can bet that these new voters will continue and extend their political involvement, meaning that in a well deserved bit of irony, Harper's Islamophobic campaign may have created a Canadian Muslim political consciousness where none existed before.
With this in mind, it is likely for good reason that in the United Kingdom, the Conservative group leader of the Greater London assembly, Andrew Boff, criticized Goldsmith's divisive campaign for damaging his party's relations with the Muslim community, something that could further hurt it down the road.
In fact, the same thing could happen in America. After all, not only is Donald Trump now a widely detested politician (polls suggest that more Americans disapprove of him than are worried about Muslims), but American Muslims are becoming more politically engaged. And although the American Muslim population is relatively small, it may hold the key to swing states like Virginia, Florida and Ohio.
Meanwhile, as Trump has chased Muslims away, Hillary Clinton and especially Bernie Sanders, her Democratic rival, have reached out. Sanders has struggled with attracting minority voters generally, but Muslim voters it seems have rewarded his attention, giving him an edge in Michigan and then Wisconsin. No matter which Democrat wins, the Democratic Party wins.
Republicans, by contrast, risk alienating almost every minority -- as well as female voters -- with a selection of Trump as their presidential nominee.
But that race will be decided in November. For now, it is worth remembering the powerful message that Sadiq Khan's London victory sends not just to anti-Muslim bigots, but also to Muslims themselves. Secular politics work: Faith-based prejudice might be real, but it is ultimately a losing proposition. And we can think of no better way to encourage and increase the embrace by British Muslims of their country and their democracy than this simple message: You will be judged by what you do, and not who you are.
The sad truth is that the very people who demand Muslims prove their fidelity to secular values have not yet themselves begun to implement these values themselves, and that includes those in the Republican Party trying to exploit tensions.
Despite Trump's success so far, we will have to wait until November to see how much success -- or damage -- his campaign has done to the Republican Party. But in the meantime, let's hope that Americans will deliver a similar message to the one Londoners just did -- that ultimately, bigotry will not succeed.
Join us on Facebook.com/CNNOpinion.
Read CNNOpinion's Flipboard magazine.