Donald Trump’s attack on Sadiq Khan is the latest in a long line of statements reflecting the far-right’s “obsession” with the London mayor, experts have said.

Shortly before the US president landed for the start of his state visit to the UK, he launched a Twitter tirade accusing the London mayor of doing a “terrible job” and being a “stone cold loser who should focus on crime”.

There were warnings that the comments could fuel harassment targeting Mr Khan, who is already under 24-hour police protection because of death threats.

A spokesperson for Mr Khan said the comments had gone beyond “childish insults”, adding: “Sadiq is representing the progressive values of London and our country, warning that Donald Trump is the most egregious example of a growing far-right threat around the globe, which is putting at risk the basic values that have defined our liberal democracies for more than 70 years.”

It came two years after Mr Trump launched another attack on the Labour mayor in the wake of the London Bridge terror attack.

President Trump in Britain for state visit: In pictures Show all 40 1 /40 President Trump in Britain for state visit: In pictures President Trump in Britain for state visit: In pictures President Trump, Prime Minister Theresa May and Jeremy Hunt, the foreign secretary, pose for a photo during dinner at Winfield House, the US ambassador's residence in London AFP/Getty President Trump in Britain for state visit: In pictures President Trump and Prime Minister Theresa May share a laugh outside of Downing Street Reuters President Trump in Britain for state visit: In pictures President Trump walks with the Queen while other guests follow as they arrive at a state banquet in Buckingham Palace AFP/Getty President Trump in Britain for state visit: In pictures The red carpet is rolled out in front of Downing Street prior to the arrival of President Trump AP President Trump in Britain for state visit: In pictures President Trump meets with prime minister Theresa May for a business roundtable meeting at St James' Palace in London AP President Trump in Britain for state visit: In pictures President Trump makes a speech at the state banquet in Buckingham Palace Getty President Trump in Britain for state visit: In pictures President Trump and the Queen share a toast at the state banquet in Buckingham Palace Reuters President Trump in Britain for state visit: In pictures Philip May and Melania Trump attend a garden party for families of Downing Street staff on the second day of President Trump's visit Getty President Trump in Britain for state visit: In pictures President Trump meets with the Queen at Buckingham Palace as he arrives on the first day of his three-day state visit PA President Trump in Britain for state visit: In pictures A mixed crowd of supporters and detractors waits outside Buckingham Palace ahead of the arrival of President Trump Reuters President Trump in Britain for state visit: In pictures President Trump and the Queen view an exhibition of items from the Royal Collection that are of historical significance to the US PA President Trump in Britain for state visit: In pictures President Trump inspects an honour guard during a welcome ceremony in the garden of Buckingham Palace AP President Trump in Britain for state visit: In pictures The police block a road leading to Westminster Abbey, where Donald Trump is visiting on the first day of his state visit PA President Trump in Britain for state visit: In pictures President Trump walks with Prince Charles in the gardens of Buckingham Palace AFP/Getty President Trump in Britain for state visit: In pictures The McDonalds restaurant on Whitehall near to Westminster Abbey provides an excuse as to why they are not serving milkshakes today, though many have speculated that it is due to the recent trend of pouring milkshakes over right wing political figures Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures Protesters with anti-Trump signs stand on Whitehall near Downing Street Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures President Trump and First Lady Melania are welcomed by the Queen, Prince Charles and Camilla at Buckingham Palace EPA President Trump in Britain for state visit: In pictures King's Troop Royal Horse Artillery perform a gun salute to honour President Trump's state visit and to mark the 66th anniversary of Queen Elizabeth's coronation at Green Park Getty President Trump in Britain for state visit: In pictures A protester stands on Whitehall near Downing Street holding a sign with an anti-Trump message Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures A supporter welcomes the president's visit on Whitehall near Downing Street Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures A miniature Trump balloon in the protest on Whitehall near Downing Street Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures A protester wears a "No Trumps" card in his hat as he walks nearby to Buckingham Palace Getty President Trump in Britain for state visit: In pictures President Trump walks with Prince Charles and a Buckingham Palace guard as he is welcomed on the first day of his three-day state visit AFP/Getty President Trump in Britain for state visit: In pictures Dedicated pro-Trump and pro-Brexit campaigner Joseph Afrane awaits the president's arrival at Buckingham Palace Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures Crowds watch as Marine One, the helicopter carrying President Trump, arrives at Buckingham Palace PA President Trump in Britain for state visit: In pictures President Trump and First Lady Melania depart from Air Force one at Stansted Airport Reuters President Trump in Britain for state visit: In pictures Supporters of the president - and detractors of London mayor Sadiq Khan - await his arrival at Buckingham Palace Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures President Donald Trump salutes an honour guard as he and first lady Melania Trump arrive at Stansted Airport AP President Trump in Britain for state visit: In pictures President Trump and First Lady Melania arrive at Winfield House, the US ambassadors residence in London AP President Trump in Britain for state visit: In pictures An anti-Trump protester awaits the president's arrival at Buckingham Palace Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures Dedicated pro-Trump and pro-Brexit campaigner Joseph Afrane awaits the president's arrival at Buckingham Palace Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures A protester mowed this message into a field nearby to Stansted Airport Born Eco President Trump in Britain for state visit: In pictures An anti-Trump protester awaits the president's arrival at Buckingham Palace Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures A marching band parades down the Mall in front of Buckingham Palace ahead of the arrival of President Trump Reuters President Trump in Britain for state visit: In pictures Supporters of the president await his arrival at Buckingham Palace Tom Batchelor / The Independent President Trump in Britain for state visit: In pictures President Trump shakes hands with Jeremy Hunt, the foreign secretary Sky News President Trump in Britain for state visit: In pictures A policeman stands on the Mall, one of the roads leading to Buckingham Palace that is closed for the president's visit Reuters President Trump in Britain for state visit: In pictures Air Force One lands carrying U.S. President Donald Trump and First Lady Melania Trump arriving for their state visit to Britain Reuters President Trump in Britain for state visit: In pictures An honour guard await Trump's departure from Air Force One at Stansted Airport Sky News President Trump in Britain for state visit: In pictures President Trump and First Lady Melania depart from Air Force one at Stansted Airport AP

The US president took a statement where Mr Khan urged Londoners not to be alarmed by increased armed police patrols out of context to write: “At least 7 dead and 48 wounded in terror attack and Mayor of London says there is ‘no reason to be alarmed!’.”

Mr Trump used the rampage, which left eight people dead on 3 June 2017, to promote his proposed travel ban on people from selected Muslim-majority countries.

His son, Donald Trump Jr, was labelled a “disgrace” months earlier for attacking Mr Khan in the wake of the Westminster attack by twisting his statement that being prepared for terror attacks was “part and parcel” of governing a major Western city.

Both the “part and parcel” and “no reason to be alarmed” soundbites have been incorporated into countless memes, blogs and videos spread online by anti-Islam extremists.

Jacob Davey, the lead on far-right research at the Institute for Strategic Dialogue, said Mr Trump’s attacks on Mr Khan acted as a “nod and a wink” to his extremist supporters.

“There is this absolute obsession with Mr Khan amongst the alt and far-right, and it is intrinsically linked to the fact he’s a Muslim of Pakistani origin,” he told The Independent.

“It ties in with broader far-right conspiracy theories, including the idea of Islamisation and that white Europeans are being culturally and ethnically displaced globally.”

Mr Davey said that the far-right’s focus on Mr Khan goes beyond legitimate criticism by implying that he is “implicitly supportive” of terror attacks and violence.

Analysts in the US have pointed to Mr Trump’s consumption of Fox News, links to Breitbart through his former chief of staff Steve Bannon and interaction with far-right social media accounts as potential sources for his statements.

Donald Trump leaves Stansted on Marine One

Mr Davey said Mr Trump’s extremist supporters were already sharing and celebrating his latest attack on Mr Khan across the internet.

Threads were started on the messaging board 4chan – known for its racist memes and alt-right subculture – and Tommy Robinson and UK “yellow vest” activist James Goddard were among those praising the president’s comments.

“It’s a self-reinforcing cycle where his most extreme supporters feed off his output and use that to encourage their behaviour,” Mr Davey added.

“When Mr Khan is targeted directly in this personal fashion by Mr Trump it acts as a nod and a wink to his extremist followers, potentially legitimising their harassment.”

It emerged last month that Mr Khan has round-the-clock police protection after receiving a deluge of death threats, which have intensified since 2016.

The Finsbury Park terrorist named the former Labour MP in a suicide note written before he ploughed a van into Muslims in 2017.

Darren Osborne told his trial that it would have been like “winning the lottery” to murder Mr Khan, if he had been able to reach a pro-Palestinian protest that was his original target.

He is frequently targeted by right-wing activists and anti-Islam groups who hold him responsible for rising violent crime and other grievances, even though stabbings in London have fallen after Mr Khan boosted police funding.

Police figures show that violence started rising in the capital in 2014, when Boris Johnson was mayor, in the wake of Conservative budget cuts to policing and preventive services.

Boris Johnson was mayor of London when violent crime started rising in 2014 (AFP/Getty)

Monday’s comments came after Mr Khan slammed Mr Trump’s response to white supremacist violence, immigration policies, proposed Muslim ban and “repeated and deliberate lies”.

In an open letter published on Sunday, the London mayor said it was “un-British” to roll out the red carpet for Mr Trump in light of his divisive behaviour, accusing him of interference in the Conservative leadership race.

Mr Trump has said Mr Johnson would do a “very good job” as prime minister, adding: “I like him, I have always liked him.”

The praise appeared to overlook some of Mr Johnson’s previous comments, including a 2015 statement accusing the Republican presidential candidate of “quite stupefying ignorance that makes him, frankly, unfit to hold the office of president” over claims about Muslim “no-go zones” in London.

The feud between Mr Khan and Mr Trump dates back to 2016, when the London mayor called a proposed Muslim immigration ban “divisive and outrageous” and voiced hope he would lose US presidential election.

Before being alerted to his comments, Mr Trump suggested he would make an exception for Mr Khan because of his position, but then challenged him to an IQ test after being called “ignorant”.

Animosity deepened during last year’s presidential visit, when Mr Khan gave approval for a giant balloon depicting Mr Trump as an angry baby to be flown over London by protesters.