A former U.S. diplomat on Friday criticized President Donald Trump for lecturing the British in the aftermath of the terror attack on a London subway.

"What the United States needs to do right now is not lecture the British, as President Trump did in a tweet this morning," CNBC contributor and former U.S. ambassador to NATO Nick Burns said during a "Closing Bell" interview. "Stand by them. Give them all the assistance."

Added the ambassador, "But let them run their own show. That's what the United States should be doing."

On Friday, at least 29 people were injured when the detonator on a crude bomb activated, but authorities say there could have been a far worse outcome had the explosive worked as intended. One of the injured included a boy who suffered serious burns.

An affiliate of ISIS claimed responsibility for the latest London attack.

Trump tweeted Friday about the U.K. attack, calling the person responsible for the incident "a loser terrorist" and appeared to suggest that Scotland Yard should have been able to stop it since they had the "sick and demented people" in their "sights." Another tweet by the president suggested "much tougher" action was needed.

https://twitter.com/realDonaldTrump/status/908642277987356673

https://twitter.com/realDonaldTrump/status/908643633901039617

British Prime Minister Theresa May also was taken aback by Trump's tweets: "I never think it's helpful for anybody to speculate on what is an ongoing investigation," she said, according to the BBC.

In remarks outside the White House before he spoke to May, Trump called the London attack "a terrible thing. It just keeps going and going, and we have to be very smart. We have to be very, very tough. Perhaps we are not nearly tough enough."

Burns, who served in the U.S. government for 27 years and also is a former Undersecretary of State, noted that the British sadly have a lot of experience when it comes to terrorism. The U.K. isn't only dealing with the current ISIS-linked jihadi terrorism but earlier suffered attacks by affiliates of al-Qaeda and, prior to that, the IRA.

After the subway attack, the U.K. terror threat level was raised to "critical," meaning an "attack is expected imminently." The raised alarm follows the terrorist attack in June involving a van that mowed down people in London and the shrapnel-laden homemade bomb in Manchester that killed 23 people and injured more than 200 others in May.

In all, the U.K. has suffered more than 3,400 fatalities linked to terrorism since 1970, including more than 125 since 2000. Friday marked the fourth terrorist attack on London this year.

Speaking on "Closing Bell," Ret. Lt. Col. Daniel Davis said the fight against terrorism requires a larger examination of the role of having American troops overseas in some countries. Also, he said some actions being taken in the war on terror might actually be contributing to the problem.

"As long as you're going after the wrong targets, I think you're going to continue to have trouble like this," said the colonel.

As an example, he said Trump recently spoke about extending the U.S. operations in Afghanistan, citing the deadly August terror attack in Spain. "He said, 'See, this is why we have to do it.' Yet when you look at what happened in Spain … it was basically homegrown and radicalized there."

"So having troops constantly fighting overseas in Iraq, Afghanistan, Syria, Pakistan — those things are not keeping us safe," Davis said. "And in fact, in some ways, they're actually contributing" to making the situation worse because he said it allows some "radicalized people" in their own mind to justify taking the wrong path.

Finally, he said "we need to really be careful" when taking the approach that it's necessary to defend ourselves with military power around the globe. "What we have to do is get at the causes of radicalism and the causes of Islamic terror. And that's not going to be done on a combat battlefield."