WASHINGTON — President Trump seized on a terrorist attack in London on Friday to promote his curbs on travel to the United States by Muslims and, in the process, ran afoul of British authorities by claiming, without evidence, that they had been aware of the identities of the assailants.
In a fusillade of early morning tweets, Mr. Trump cited the chaotic scene in a London Underground station as Exhibit A for his hard-line policies. The ban on visitors from predominantly Muslim countries, he wrote, should be “far larger, tougher and more specific,” while his “proactive and nasty” military campaign against the Islamic State, he said, has made more progress in eight months than the Obama administration did in eight years.
But Mr. Trump’s assertion that the assailants “were in the sights of Scotland Yard” angered Prime Minister Theresa May, who said it was not helpful for anyone to speculate while an investigation was underway. Mr. Trump was later briefed about the attack and called Mrs. May with condolences, according to a senior official, though he did not apologize.
The podcast that makes sense of the most delirious stretch of the 2016 campaign.
It was the latest episode in which Mr. Trump has been at odds with Britain. In June, he criticized London’s mayor, Sadiq Khan, over his response to a deadly terrorist attack, misconstruing Mr. Khan’s words. In March, Sean Spicer, the White House press secretary at the time, repeated allegations that a British intelligence agency had wiretapped Trump Tower, a charge that British authorities dismissed as “utterly ridiculous.”
It was also a sign that for all the talk about a more disciplined White House under the new chief of staff, John F. Kelly — who has urged the president to have tweets vetted by his staff — Mr. Trump was still determined not to censor himself on social media and was fully capable of roiling the diplomatic waters with a single unguarded post.
At 6:42 a.m., Mr. Trump tweeted that “sick and demented people who were in the sights of Scotland Yard” carried out the explosion, which left 29 people injured in the blast and ensuing panic. It was not clear where Mr. Trump had gotten that information, though 23 minutes earlier, “Fox and Friends,” a program Mr. Trump regularly watches, broadcast a report in which an outside security analyst said the London police probably already knew the identity of the attackers.
“Can someone tell Scotland Yard?” asked Brian Kilmeade, one of the hosts of the program.
White House officials said they did not know whether “Fox and Friends” was the source for Mr. Trump. They tried to play down the contretemps, saying Mr. Trump’s tweet was referring to the longstanding efforts of British law enforcement authorities to investigate would-be terrorists, not to anyone involved in Friday’s attack.
“What the president was communicating is that obviously all of our law enforcement efforts are focused on this terrorist threat for years,” said the national security adviser, Lt. Gen. H. R. McMaster. “Scotland Yard has been a leader, as our F.B.I. has been a leader.”
The authorities in London said they were treating the explosion as terrorism. It was not immediately clear who was behind the attack or whether the assailant or assailants had been on the radar of British intelligence, as Mr. Trump suggested.
In short remarks to reporters on Friday morning, Mr. Trump said he had been briefed on the explosion but did not elaborate on what he meant in his reference to Scotland Yard.
The police in London also alluded to the president’s Twitter post. “This is a live investigation and we will provide further updates as it progresses,” the Metropolitan Police said in a statement.
“Any speculation is extremely unhelpful at this time,” the statement said.
Other past comments from Mr. Trump have also frustrated British officials.
Shortly after his election, he said that Nigel Farage — a key supporter of Britain’s vote to leave the European Union — should be made the British ambassador to the United States, a decision that, London pointed out, was not Mr. Trump’s to make.
Mr. Trump gripped Mrs. May’s hand when she visited him at the White House, a week after he took office, a gesture that some British critics interpreted as awkward or even aggressive. Last month, Mrs. May joined other world leaders in criticizing Mr. Trump’s response to the white supremacist violence in Charlottesville, Va.
“True or not — and I’m sure he doesn’t know — this is so unhelpful from leader of our ally and intelligence partner,” Ms. May’s former chief of staff, Nick Timothy, wrote on Twitter.
John D. Cohen, a former United States counterterrorism official, said statements such as the president’s about Scotland Yard could hurt an investigation.
“At this stage investigators are going to be doing everything they can to locate those involved in the attack, and in particular the bomb maker,” said Mr. Cohen, now a professor at Rutgers University. “These types of statements — at this stage of the investigation — can undermine law enforcement efforts because it discloses key information that the investigators may be using to locate the attackers, and it could put people’s lives at risk.”
The United States and Britain regularly share intelligence, and if British officials did know the assailant or assailants behind Friday’s attack, it is likely that information would have been known to American intelligence officials.
Mr. Trump’s travel ban, proposed in January and revised in March, has faced legal challenges and drawn criticism from around the world because of concerns that it amounts to discrimination based on religion.
Eileen Sullivan contributed reporting from Washington, and Sewell Chan from London.