​If Sadiq Khan’s aim for his visit to Scotland yesterday was to offend half of the population in one fell swoop, then the trip was an unmitigated success. The London Mayor threw himself into the debate over Scotland’s constitutional future with all the grace of a Sutton United’s reserve goalkeeper munching on a touchline pie.

Indeed, Khan’s comments achieved the remarkable feat of uniting people from all sides of the debate in Scotland in a state of head-scratching bewilderment. Let’s take a moment to consider what he said.

“We’ve seen Brexit, President Trump elected in the United States and the rise of right-wing populist and narrow nationalist parties around the world. It’s up to us – whether in Scotland or in London – to fight this trend,” Khan told Scottish Labour’s conference in Perth.

There’s little to object to there. The United States and Europe have been gripped by a fervent politics of fear and suspicion of immigrants. It’s common sense that this must be opposed by progressive forces everywhere.

“There’s no difference between those who try to divide us on the basis of whether we’re English or Scottish and those who try to divide us on the basis of our background, race or religion.”

Wait a minute, what? Scottish people who want independence are now the same as bigots and racists?

By likening ‘Yes’ voters to the likes of Donald Trump, Khan is guilty of either wilful ignorance or a spectacular lack of insight into Scottish politics. A cursory glance at the movement for independence would have informed him that it is based on a civic, inclusive nationalism rather than any kind of ethnic “blood and soil” fervour.

Nicola Sturgeon has called the remarks “spectacularly ill-judged”. She’s right. Not only was Khan substantively wrong, he also managed to deal yet another blow to Scottish Labour’s flailing hopes of any kind of political comeback.

He did later seek to caveat his remarks, insisting that of course he wasn’t “saying that nationalists are somehow racists or bigoted”. You could have fooled us, Sadiq.

Are there reactionary elements to Scottish nationalism? Absolutely. It would be an anomaly if there weren’t, considering it’s a movement which includes such vast swathes of the country’s population.

Neither is Scotland immune from racism. Immigrant communities, whether they be Irish, Pakistani or Romanian, have faced, and continue to face, persecution. There should be no room for complacency or overinflated ideas of Scottish exceptionalism when comes to these issues.

However, in recent years, the movement for independence has been overwhelmingly internationalist and outward looking in nature. It has been defined by a rejection of austerity, opposition to nuclear weapons and imperialist wars and by a predominantly welcoming attitude towards immigrants. Indeed, a recent Panelbase poll found that, compared to “No” voters, supporters of independence believed that immigration was not a major problem by a whopping margin of 37 points.

It was the British Prime Minister Theresa May who approved giant billboards to be driven around towns stating “Go Home or Face Arrest”. It’s the UK Government which locks asylum seekers up indefinitely in detention centres and refuses to guarantee the rights of EU citizens who have made the UK their home. Meanwhile, the Brexit referendum has seen a return of nostalgia for the British empire and an anti-immigrant sentiment, which had been bubbling under for many years, come to the fore.