Sadiq Khan was forced to backtrack and amend a speech to the Scottish Labour conference after an earlier version sparked a row with the SNP for suggesting that nationalism can be as divisive as racism and religious hatred.

A draft of the Mayor of London's speech, made public before his appearance at Perth Concert Hall, included the line: “The last thing we need now is to pit different parts of our country or sections of our society against each other – or to further fuel division or seek separation.

"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 base of our background, race or religion.”

Nicola Sturgeon dismissed the comments as “ill-judged” in tweets in reply

“I’m a big admirer of @SadiqKhan but today’s intervention is spectacularly ill-judged,” she wrote on Twitter.

“It is an insult to all those Scots who support independence for reasons of inclusion and social justice – the antithesis of what he says and it is a sign of the sheer desperation and moral bankruptcy that has driven so many from Scottish Labour’s ranks.

“Very disappointing.”

She later added: “Labour in a hole today and – from some of their tweets to me – seem intent on digging it deeper. It’s desperation. We should all rise above it.”

Mr Khan subsequently changed the speech when he delivered it, telling delegates at the conference: “Of course I'm not saying that nationalists are somehow racists or bigoted”.

He went on to say that London and Scotland are “twin beacons of progressive values”.

But he warned: “There are some in Scotland who are determined to define London as Scotland’s enemy – to turn us against each other.”

He went on to claim that only Labour can deliver unity between Scotland and England, in a speech seen as an attempt to woo back the hundreds of thousands of former Labour voters who defected to the SNP in the 2015 general election.

The party was almost wiped out in Scotland in the general election which followed hard upon the heels of the 2014 independence referendum.

The SNP took all but three seats in an unprecedented landslide, while Labour lost 40 of the 41 seats they were defending.