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.
The White House did not immediately respond to questions about Mr. Trump’s assertions.
Mr. Trump used the terror attack to revive his push for a travel ban for people from predominantly Muslim countries, an effort that has been hampered by United States courts.
It was not the first time Mr. Trump seized on a terror attack in London to promote his political agenda, including the travel ban and a crackdown on intelligence leaks to the media.
In May, Mr. Trump joined in the British criticism over claims that American officials disclosed the name of the Manchester concert bomber to reporters. For months, Mr. Trump had been pushing for tougher consequences for intelligence leaks, and he pledged America would find and punish the leakers. And in June, Mr. Trump used a terrorist attack near the London Bridge to draw support for his travel ban.
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 peoples’ 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.
In Mr. Trump’s other morning Twitter posts about terrorism, he said his administration had already “made more progress” against the Islamic State than President Barack Obama’s administration had in eight years. And he called for being “proactive & nasty” to fight terrorists.
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.