LONDON — The British revolt against President Trump swelled Thursday with Parliament members openly deriding him and Britain’s prime minister standing by her denunciations of Trump’s retweets of a fringe group’s anti-Muslim videos.

Prime Minister Theresa May blasted Trump for crossing a line by posting the inflammatory videos on his Twitter page Wednesday — and then warning May to essentially mind her own business and focus on Islamist terrorism instead of him.

But officials were careful to note that ties with the United States are stronger than the current flare-up with the White House.

“It’s increasingly clear that any official visit from President Trump to Britain would not be welcomed,” tweeted London’s mayor, Sadiq Khan, the first Muslim to hold the office. Khan has repeatedly called for Britain to withdraw an invitation for Trump to visit — and his stance appeared to gain backing amid the outrage against the president.

In a sign of the disruptive wake unleashed by Trump, British Home Secretary Amber Rudd had to remind Parliament and the public that Britain’s relationship with the United States was bigger than one president — and that important trade, security and intelligence sharing are ongoing.

President Trump retweeted three anti-Muslim videos Nov. 29, posted by the far-right group 'Britain First.' Here's what you need to know about the videos. (Elyse Samuels,Deirdra O'Regan/The Washington Post)

The Trump tweets were widely seen in Britain as the kind of exchange he might have had with a hostile power, not the United States’ closest ally and certainly not one facing Islamist terrorist attacks at home while fighting alongside the United States against the Islamic State in Syria and elsewhere.

British officials were shocked at the personal nature of the tweet against May and the suggestion that Trump was boasting — even gloating — that the United States has been relatively free of terrorist attacks while Britain has suffered a string of deadly assaults.

“@Theresa_May, don’t focus on me, focus on the destructive Radical Islamic Terrorism that is taking place within the United Kingdom,” Trump tweeted late Wednesday. “We are doing just fine!”

Trump was responding to statements from 10 Downing Street that the president was “wrong” to retweet three anti-Muslim videos from the far-right group Britain First, which describes itself as a defender against growing Islamic influence in Britain.

Trump later deleted and reposted the tweet aimed at May — because he had gotten the social media address of the prime minister wrong — suggesting to many British officials that the president was operating alone, without consultation or support from White House advisers.

May on Thursday reiterated her stance that Trump was “wrong” to share the anti-Muslim tweets.

But at a news conference in Jordan, she repeatedly deflected questions about Trump’s tweet that criticized her. Instead, she spoke about what’s called the special relationship between Britain and the United States, saying it was “an enduring relationship because it is in both our national interests for that relation to be there.”

Asked whether she would fire someone from her senior leadership team if they retweeted the same account Trump did, she said: “I have absolute confidence that my cabinet ministers would not be retweeting material from Britain First.”

Trump has a history of jumping on Twitter and causing headaches for British officials. But this was the first time that he publicly took aim at the British prime minister.

Sajid Javid, Britain’s communities secretary, tweeted that Trump “endorsed the views of a vile, hate-filled racist organisation that hates me and people like me. He is wrong and I refuse to let it go and say nothing.”

Trump once tweeted that Nigel Farage, the former leader of the anti-immigrant U.K. Independence Party, would be a “great” choice as British ambassador to the United States. He also attacked Khan, London’s mayor, following a terrorist attack at London Bridge.

Trump’s latest missives prompted an urgent debate in Parliament on Thursday, where politicians across the political divide lined up to condemn the president’s tweets. In remarks rarely uttered about a U.S. president in the House of Commons, some parliamentarians mocked Trump as “stupid.”

Stephen Doughty, a Labour Party lawmaker, told Parliament: “By sharing it, he is either a racist, incompetent or unthinking — or all three.”

He also added that “I love America,” that his great-grandfather was an American soldier and that he has traveled extensively in the United States. “It is a country and people of extraordinary generosity, courage, kindness and humanity — but this president represents none of those things.”

“We have been clear — President Donald Trump was wrong to retweet videos posted by far-right group Britain First,” Rudd said.

But she also urged lawmakers to consider the bigger value of the deep ties with the United States.

“This is a president that behaves unlike any other in the nature of the tweets he puts out. I don’t believe that should be able to undermine an overall important relationship with our country,” she told the BBC.

Vince Cable, the leader of the Liberal Democrats, was one of many to call on May to cancel the state visit offered to Trump.

British leaders are playing a nuanced game, analysts said, trying to call out Trump when they believe he crosses a line but also trying to stay in his good graces as the country moves toward exiting the European Union. After Britain leaves the European bloc, it hopes to strike new trade deals with Washington and others.

Robin Niblett, director of Chatham House, a London-based think tank, said that many British prime ministers have faced awkward moments with U.S. presidents over the years. But what stood out was the personalized nature of the latest barbs.

“There have been moments of real tension, surprise and the impression of real damage to U.S.-U.K. relationship” in the past, Niblett said. “We’ve had this kind of thing before but not this vituperative backward and forwards,” he said. “It’s a modern variant, a Trump variant, of previous tensions.”