Whatever one’s view about Sadiq Khan and Islamist extremists, the claim that the first has been compromised by his association with the second is striking for a feature on which its supporters and opponents can agree: it relates almost entirely to the years before and immediately after 2005.  Put aside for a moment those allegations that relate to his work as a solicitor – such as his strident defence of the anti-semitic hate preacher Louis Farrakan – and consider the context of most of the others.

2005 saw the 7/7 and 21/7 terror attacks, two years after the invasion of Iraq.  The fashion then was to claim that Islamist terrorism was caused solely, or almost entirely, by the foreign policy of western governments.  Hence the letter to the Guardian in August 2006, co-signed by Khan, making exactly that argument: “current British Government policy risks putting civilians at increased risk both in the UK and abroad”, part of it read.

Since that period, British troops have withdrawn from Iraq and from Afghanistan, too.  But Islamist terror worldwide continues.  The Danish cartoons row, which was followed by a boycott of goods from Denmark in some Muslim-majority countries, was a warning.  What had cartoons of Mohammed to do with western foreign policy?  Later came the Charlie Hebdo murders, another terror assault in Paris later that year and yet another during this one, and the terrorist bombings in Belgium – a country with no military presence abroad worth speaking of.

In other words, the case for believing that western foreign policy drives Islamist terror has gradually crumpled.  Conservative policy in Britain now targets the extremist ideology that drives extremist acts.  Labour’s view is more confused, but its politicians cannot ignore the continuum between preaching a hatred of Jews, for example, and anti-Jewish violence.  Anti-semitic attacks in Britain last year reached the highest level yet recorded.  Indeed, many of Labour’s most prominent politicians have campaigned ferociously against racism and anti-semitism all their lives.

Hence the fissiparous row within the party – heightened by slights, internal disputes, grudges nursed over many years and wildly different views of Jeremy Corbyn’s leadership – over Ken Livingstone’s contemptible remarks.  And hence, too, Khan’s increasing care not to share platforms with or be compromised by Islamist extremists.  He has clocked the shifting view among the elites that shape policy, which includes a growing realisation on parts of the Left that Islamist views on the subjugation of women and gay people are incompatible with its own commitment to progress and justice.

Voters share this hardening stance, and Khan himself is well aware of it.  He worries aloud in this morning’s Observer that the Livingstone contretemps, and the corruption of Labour’s integrity by anti-semitism, could lose him this week’s London Mayoral election: part of the purpose of his remarks is doubtless to get his vote out on Thursday.  Khan is no fool.  He realises that polls show him set to win the contest and that, if they are accurate, only a swing against Labour by the moderate, mainstream mass of Londoners is likely to deny him the mayoralty.

This shift of rhetoric and attitude over ten years is a key to understanding Khan.  He is no Islamist extremist.  His clear and consistent opposition to anti-semitism alone shows that.  And he is right to point out that groups such as Hizb ut-Tahrir and the banned Al-Muhajiroun (and their successors) regard him as a traitor and an apostate.  They hate him, and he doubtless hates them back.  But he has not always opposed extremism vociferously, either – at least, in the sense that his fellow Labour MP, Khalid Mahmood, has done.

Mahmood helped to lead the charge in 2014 over the “Trojan horse” allegations in Birmingham, which resulted in a Government investigation and report.  Peter Clarke, the former head of counter-terror for the Metropolitan Police, who conducted the inquiry, concluded that there was  “very clear evidence that young people are being encouraged to accept unquestionably a particular hardline strand of Sunni Islam that raises concerns about their vulnerability to radicalisation in the future”.

But where Mahmood consistently rises to the challenge, Khan has sometimes ducked it.  In 2006, he attended a rally at which Azzam Tamimi, a leading Muslim Brotherhood figure, threatened “fire throughout the world”. Khan dismissed that language: “Speakers can get carried away, but they are just flowery words”, he said.  Tamimi has said that Israel should be destroyed and replaced with an Islamic state – and that then, its Jewish population should “sail on the sea in ships back to where they came or drown in it”.

In short, Khan “possesses a remarkable ability to understand what an audience wants to hear, and an almost unbounded willingness to say it” – as Andrew Gimson wrote of him on this site, as well as an acute ear for changing ideological fashion. This operational sixth-sense is perhaps the first requirement of a successful politician, and Khan clearly has it in spades.  He has climbed seamlessly from Wandsworth Council to the Commons to the Cabinet and now, given Labour’s likely exclusion from national office for some time, is on the verge on mastering the next rung.

I know little of Labour’s internal workings, especially in detail in London.  But you can bet that Khan knows a lot: indeed, that there is nothing important that he does not know.  No senior Conservative politician has built up such a tungsten-solid local power base: Boris Johnson is perhaps the nearest equivalent, and citing his name helps to show – were demonstration needed – what a master of the arts of politics Khan is.  The London Mayor is invariably off-message.  The man who would succeed him, by contrast, never strays from it.

As a not-very-adept former politician myself, I can’t help but admire a practising one who is so pitch-perfect.  But his technical gifts as an operator are no reason for my fellow-Londoners to vote for him on Thursday.  When the mists clear around Khan, what emerges through them is a more-or-less standard left-wing politician, but with a sensitive nose for where the political wind will blow next. He was for Heathrow expansion, but is now against it.  He nominated Corbyn, yet didn’t vote for him.

He opposes extremism but, as Mike Freer has pointed out on this site, has none the less relied on Momentum during his present campaign.  His sums on tube prices don’t add up (and would bust Transport for London’s budget) and nor do his plans for rent control (which would deeply damage the housing market in London).  Perhaps he would row back from all this if elected; perhaps not.

I write that Khan is unlike Boris in most respects, but there may be a resemblance in one.  Boris left the Commons, has been elected twice as London’s Mayor, has returned, and now has his eye on the Conservative leadership.  Were I Khan, I would be pondering my chances of a Commons return in 2024 or so, just in time for a national Labour revival – and a crack at Labour’s leadership myself.  He has risen far.  If the latest polls are reliable (though there is still all to play for), he is set to win on Thursday.  If he does, he could rise further still.