It was always going to be difficult for a Conservative candidate to win London in 2016, given the demographic and political shifts in the city.
But Zac Goldsmith could have fought an honourable campaign which sought to exploit his cross-party appeal, while deploying credible and effective attacks against his Labour opponent.
He did neither. Instead Goldsmith ran a campaign which was both unrelentingly nasty and also totally ineffective. His attempts to paint Sadiq Khan as a friend of extremists never worked because they never rang true. Anyone with the slightest knowledge of Khan knew he was as far from being a dangerous radical as Goldsmith is from being a down-to-earth man of the people. The Tory attacks against Ed Miliband and Ken Livingstone worked because they chimed with what people already believed. The Tory attacks against Khan never did.
But even if there had been some truth to their portrayal of Khan, attempting to run a race-based campaign in a city as overwhelmingly multicultural and tolerant as London was always going to be counter-productive. At the start of the campaign, many on the left were at best ambivalent, if not openly hostile to Khan. But by running such a vicious and dishonest race, Goldsmith actively mobilised left and liberal voters to Khan's defence. As one Tory big beast said privately this afternoon, Zac's campaign was blowing "a dog whistle in a city where there's no dog."
At the same time, Goldsmith undid much of the Conservatives' good work winning over ethnic minority voters in the capital. As former Tory London Assembly leader Andrew Boff told Newsnight last night, by equating conservative religious views with terrorism, Goldsmith has done potentially longstanding damage to the Conservatives' relationship with Muslim voters. One senior London Tory told me today that the anti-Muslim scaremongering conducted by Goldsmith's campaign had been "poisonous". They said that while previously the party had been courteously received by Muslim Londoners, he worried that they would no longer be so.
And all of this is before even considering Goldsmith's patronising and ham-fisted attempts to win over Sikh and Hindu voters with threats about Khan coming after their jewellery.
So Goldsmith's anti-Khan campaign didn't work. But even if it had, it was both morally suspect and outright dangerous. At a time when London faces the real threat of terrorist attack, the Conservatives' attempts to raise and exploit fears about Islamic extremists could have had grave consequences for Muslim people living in the city. The fact that most Londoners have either ignored his campaign or chosen to reject it altogether is a huge credit to the city.
Most people who meet Goldsmith are impressed with his charm and easy manner. In the past he has run dignified campaigns on issues he clearly cares about, from airport expansion to democratic reform. None of that will now be remembered. Instead he will go down in history as the politician who ran one of the dirtiest and most disgraceful campaigns in recent British political history.
There's no shame in losing. There can be shame in the manner of losing. Goldsmith should be thoroughly ashamed of how he lost this race.