Zac Goldsmith has lost, his reputation ruined, a political disgrace consigned to the history books. He had a choice. He could have capitalised on his reputation as a liberally minded, eco-friendly Tory, crossing partisan divides, love-bombing a city that has increasingly become a Labour heartland. Initial polls suggested he had a chance, even a significant lead. The cheerleaders for Tessa Jowell, the Blairite candidate in Labour’s selection race, wrongly suggested Sadiq Khan was unelectable.

Instead, Goldsmith waged a campaign soaked in racism, in one of the most ethnically diverse cities on Earth, shamelessly exploiting anti-Muslim prejudices in an effort to secure a shameful victory. Khan was a candidate who “repeatedly legitimised those with extremist views”, he wrote in the Mail. London was offered a campaign of fear, smear and bigotry. And London overwhelmingly told it where to go.

Khan is a progressive Muslim who received death threats for voting for equal marriage, unlike most of Goldsmith’s parliamentary colleagues. His eclectic campaign team includes gay men and Jewish women. By attempting to link Khan with Islamist extremism, fundamentalism and terrorism, Goldsmith’s campaign rightly goes down in history along with the racist Tory campaign in Smethwick during the 1964 general election and the homophobic Liberal campaign in Bermondsey in 1983. But they were – with all due respect to both communities – only byelections.

After a decisive electoral victory, there is always the temptation to be gracious to the defeated. Not this time

London is one of the most influentials cities on Earth. Were a campaign to have won there by exploiting anti-Muslim hatred, the consequences would have been felt across the western world. Would Londoners have been able to look their fellow citizens in the eye? The thought of people, in the privacy of their polling booth, their pencil hovering over the ballot paper, their mind flashing with “extremism” and “terrorism” and “Muslim”, and then rejecting a candidate on account of his faith. London’s image of acceptance and diversity would have been shattered, perhaps for a generation.

After a decisive electoral victory, there is always the temptation to be gracious to the defeated. The victor shakes the hands of their competitor. All is forgiven: what was said amid the passion of the contest belongs to the past. Hearty applause is offered to the loser.

Not this time. A candidate exploited and incited prejudice and hate. He undermined community cohesion. He indicated to young Muslims that there was no point engaging in the democratic process, because even the most progressive Muslim would be treated as aiding and abetting extremists. And in doing so, Zac Goldsmith became a recruiting sergeant for the very extremists he attempted to smear Khan with.

No forgiveness, no forgetting. Wherever Goldsmith now goes, he should be met with protests, regarded as persona non grata among an already reviled political elite. When politicians are accused of “doing a Zac”, they may end up complaining on account of the gravity of the slur.

That’s not sadism. If Goldsmith does not suffer these consequences, politicians may wage these campaigns of fear over and over again. They were already emboldened by the tawdry campaign of fear used to stop Scottish independence. “It worked!”, they exclaim, as though there was no lasting consequences on the Scottish political scene.

The Conservatives won their malicious campaign against Labour in the general election, ruthlessly demonising Ed Miliband and fanning anti-Scottish resentment. The campaigns of Bermondsey and Smethwick are now infamous, but they succeeded. This time is different, and tragically unique in that regard. This time, a campaign of fear met its nemesis: hope. The political elite has been taught a lesson they must not be allowed to forget.

UK elections: Sadiq Khan 'has won' London mayoral race - live updates Read more

But Goldsmith must not become the fall guy. This campaign was orchestrated, licensed and directed by No 10. Over the last few days I have been repeatedly attacked as a rightwing establishment sellout for confronting antisemitism on the left. Yet these Tory smears against Khan did not pop up in the occasional Facebook post of some oddball Tory councillor. They were employed by the prime minister himself in parliament. They were regurgitated by the Evening Standard, an increasingly farcical Tory mouthpiece which insulted the people of London by claiming: “This paper has done its best to be even-handed over the course of this campaign.”

The decency of Tories like Peter Oborne – who called the campaign “repulsive” – and former Tory candidate Shazia Awan – who called it “racist” – shone through. But they were a small minority. Now senior Tories are condemning the campaign as “poisonous” and as “outrageous”. Too late. The damage is done. And by condemning any alleged antisemitism on the left, and staying silent about anti-Muslim prejudice on the right, they reveal they have no interest in fighting racism. For the Tories, racism is a convenience: a hammer to batter their opponents with, or to exploit for political advantage.

Over the coming days, Tories will try to distance themselves from this campaign. They cannot get away with it. Yes, Goldsmith is to be held in contempt: a man of decency would have rejected this gutter strategy. But the Tories as a whole are collectively responsible, and it must never be forgotten.