“At least 7 dead and 48 wounded in terror attack and Mayor of London says there is ‘no reason to be alarmed!’” Mr. Trump wrote on Twitter.
Either Mr. Trump misunderstood what Mr. Khan had said or distorted it. During an interview shown on the BBC, the mayor said he was “appalled and furious that these cowardly terrorists would target” innocent civilians and vowed that “we will never let them win, nor will we allow them to cower our city.”
He went on to say that residents should not worry as they encounter more police officers patrolling the streets.
“Londoners will see an increased police presence today and over the course of the next few days,” Mr. Khan said. “No reason to be alarmed. One of the things, the police, all of us need to do, is make sure we’re as safe as we possibly can be. I’m reassured that we are one of the safest global cities in the world, if not the safest global city in the world, but we always evolve and review ways to make sure that we remain as safe as we possibly can.”
Mr. Khan’s office later dismissed the president’s post, saying the mayor was too busy to reply. “He has more important things to do than respond to Donald Trump’s ill-informed tweet that deliberately takes out of context his remarks urging Londoners not to be alarmed when they saw more police — including armed officers — on the streets,” a spokesman for the mayor said in a statement.
Critics of Mr. Trump in Britain and the United States faulted him for his acrimonious response to the Saturday assault. “I don’t think that a major terrorist attack like this is the time to be divisive and to criticize a mayor who’s trying to organize his city’s response to this attack,” former Vice President Al Gore said on CNN’s “State of the Union” on Sunday.
But the White House showed no signs of backing down, and a top aide to Mr. Trump amplified the attack shortly afterward. Dan Scavino, the president’s director of social media, posted a message referring to Mr. Khan’s criticism of Mr. Trump a year ago for his “ignorant view of Muslims.”
Other parts of the United States government sought to smooth over the dispute. “I commend the strong leadership of the @MayorofLondon as he leads the city forward after this heinous attack,” Lew Lewis, a career diplomat serving as acting American ambassador to London, wrote on Twitter hours later.
Mr. Trump at first responded with similar expressions of an ally and called Prime Minister Theresa May of Britain on Saturday night to offer condolences. A statement from the White House said that the president had “praised the heroic response of police and other first responders and offered the full support of the United States government in investigating and bringing those responsible for these heinous acts to justice.”
But as the hours passed and Saturday night turned into Sunday morning, Mr. Trump pivoted to cite the attack to build support for his proposed travel ban on visitors from select Muslim-majority countries, which has been blocked by the courts, and to argue that gun control was pointless because terrorists in this case used other weapons.
“We need the courts to give us back our rights. We need the Travel Ban as an extra level of safety!” he wrote in one message.
“We must stop being politically correct and get down to the business of security for our people,” he wrote in another. “If we don’t get smart it will only get worse.”
“Do you notice we are not having a gun debate right now?” he added on Sunday morning. “That’s because they used knives and a truck!”
Gun control advocates quickly noted that the casualty toll might have been much higher had the attackers had access to high-powered firearms. Britain has some of the world’s strictest regulations on private gun ownership.
Mr. Trump first tussled with Mr. Khan publicly last year shortly after Mr. Khan’s election as mayor. At the time, his proposed Muslim ban applied to all Muslims from all countries who were not American citizens, but Mr. Trump said he welcomed Mr. Khan’s election and would make an exception to the ban for him.
Mr. Khan replied that he wanted no exception from Mr. Trump and accused him of harboring “ignorant views about Islam.” Mr. Khan said that Mr. Trump would only encourage Muslim alienation from the West. “He’s playing into the hands of extremists,” he said.
Mr. Scavino at the time fired back on Mr. Trump’s behalf, writing on Twitter that it was not ignorance: “It’s called not being ‘politically correct.’ @realDonaldTrump will MAKE AMERICA SAFE & GREAT AGAIN!”
The feud continued after Mr. Trump won election and took office. In March, after a terrorist attack in London, Donald Trump Jr. posted a link to an article in Britain’s Independent newspaper from the previous September quoting Mr. Khan about terrorism.
“You have to be kidding me?!: Terror attacks are part of living in big city, says London Mayor Sadiq Khan,” the younger Mr. Trump wrote at the time.
Mr. Trump’s post left the impression that Mr. Khan was minimizing the importance of terrorist attacks. But in fact, he was saying that terrorism was a reality that a big city needed to be prepared to prevent and respond to vigorously.
“Part and parcel of living in a great global city is you’ve got to be prepared for these things, you’ve got to be vigilant, you’ve got to support the police doing an incredibly hard job,” Mr. Khan said.
“That means being vigilant, having a police force that is in touch with communities, it means the security services being ready, but it also means exchanging ideas and best practice,” he added.
Asked later during a television interview about the president’s son, Mr. Khan dismissed the post much as his office would do about the president’s tweet two months later. “I’m not going to respond to a tweet from Donald Trump Jr.,” he said on CNN. “I’ve been doing far more important things over the last 24 hours.”