Mr. Trump’s personality has injected an unpredictable element into the long alliance with Britons, whose perception of American leaders has sometimes been ambiguous.
Former Prime Minister Tony Blair, for instance, was castigated frequently for being so close to President George W. Bush in the run-up to the invasion of Iraq in 2003 that he was mocked as America’s “poodle.”
For all that, Mr. Trump’s break with the traditional orthodoxies of diplomacy has taken the perception that there is a trans-Atlantic disconnect to higher levels.
Mr. Johnson, the American ambassador, told the BBC on Tuesday that Mr. Trump was “never going to go down the path of a lot of politicians” by behaving in a “namby-pamby” way. “Maybe he’ll ruffle feathers,” he said of the president. “There’s no question that maybe some feathers were ruffled.”
That was a reference to the most recent spat, when Mr. Trump retweeted three posts that had originated with a small, extreme right-wing group called Britain First. The posts included video clips portraying Muslims in a hostile way that were widely interpreted as Islamophobic.
Displaying an uncharacteristic bluntness in dealings with an American president, Mrs. May said Mr. Trump had been “wrong” to send the messages. The president responded on Twitter: “Don’t focus on me, focus on the destructive Radical Islamic Terrorism that is taking place within the United Kingdom. We are doing just fine!”
That message struck a raw nerve, because Britain has been the target of five terror attacks this year in which dozens of people have died, and the security services also claim to have thwarted several more, including a conspiracy to murder Mrs. May herself.
During one attack in July, Mr. Trump also seemed to take a jab at Sadiq Khan, the first Muslim to be elected mayor of London. “At least seven dead and 48 wounded in terror attack and Mayor of London says there is ‘no reason to be alarmed,’ ” Mr. Trump said on Twitter on June 4, after an attack on London Bridge and a nearby market.
Mr. Khan has been no less sharp-tongued about Mr. Trump, saying the American president should not visit Britain because “his policies go against everything we stand for.”
Such exchanges have fanned an undisguised hostility among Mr. Trump’s critics in Britain, where there have been calls for the president’s visit to be called off or met with protests. Indeed, Mr. Trump’s reposting of the extreme-right video clips brought a rare unity among British politicians in condemning him.
Against that backdrop, British diplomats have emphasized that in areas such as security and intelligence, the two countries have deep ties whose durability and importance transcend individual leaders.
“What we have here is not just Trump the man but the institution” of the American presidency, said Sir Christopher Meyer, a former British ambassador to Washington.
The BBC quoted unidentified sources on Tuesday as saying a working visit was possible in late February to dedicate the new American Embassy, which is relocating from Grosvenor Square in central London to the Nine Elms area south of the River Thames.
Speaking to the BBC, Mr. Johnson, the American ambassador, said no date had been set for the president to visit Britain, but “absolutely, I think he will come.”
“It hasn’t been officially announced, but I hope he does,” the ambassador said.