In an interview with the Fox Business Network in Davos, Switzerland, on Thursday, Trump said he was not sure the NATO military alliance would be there to support the US if and when requested.
"I've always said, will they be there if we ever needed them and that's really the ultimate test and I'm not sure of that," Trump said.
"We've never needed them, we have never really asked anything of them. You know, they'll say they sent some troops to Afghanistan or this or that -and they did, they stayed a little back, a little off the front lines."
In the UK, which backed the United States in Afghanistan after the September 11, 2001 attacks, and more controversially in Iraq two years later, the reaction was raw.
UK Prime Minister Sir Keir Starmer condemned Trump's remarks about allied troops in Afghanistan.
"I consider President Trump's remarks to be insulting and frankly appalling and I am not surprised they have caused such hurt to the loved ones of those who were killed or injured and, in fact, across the country."
Then-prime minister Tony Blair said after 9/11 that the UK would "stand shoulder to shoulder" with the US in response to the al-Qaeda attacks.
More than 150,000 UK troops served in Afghanistan in the years after the US-led 2001 invasion, the largest contingent after the US, and 457 died in the campaign.
"Those British troops should be remembered for who they were: heroes who gave their lives in service of our nation," UK Defence Secretary John Healey said.
Ben Obese-Jecty, an MP of the opposition Conservative party, who was in Afghanistan as a captain in the Royal Yorkshire Regiment, said it was "sad to see our nation's sacrifice, and that of our NATO partners, held so cheaply by the president of the United States".
Starmer's office had earlier in the day said Trump had been "wrong to diminish the role of NATO troops" during two decades of war.
UK veterans minister Alistair Carns, whose own military service included five tours including alongside US troops in Afghanistan, called Trump's comments "utterly ridiculous".
"We shed blood, sweat and tears together. Not everybody came home," he said in a video posted on X.
Stuart Tootle, a retired colonel who commanded the first UK battle group sent to Helmand, Afghanistan's largest province, in 2006, said Trump should apologise.
He also said that while he had "some sympathy" for Trump's criticism of what he described as under-investment in NATO by the UK and other members, he had none for the president's "really unfortunate, inaccurate and totally unjustified" remarks.
It was not the first time that Trump downplayed the commitment of NATO members over the past few days.
It has been one of his pivotal lines of attack as he escalated his threats to acquire Greenland, a semi-autonomous territory belonging to Denmark.
The only time Article 5 of NATO's founding treaty has been used was in response to the 9/11 attacks.
The article is the key mutual defence clause obliging all member countries to come to the aid of another member whose sovereignty or territorial integrity might be under threat.
"When America needed us after 9/11, we were there," former Danish platoon commander Martin Tamm Andersen said.
Forty-four Danish soldiers were killed in Afghanistan, the highest per capita death toll among coalition forces, and eight more died in Iraq.
Trump's threat to slap tariffs on European countries opposed to his ambitions to purchase Greenland raised questions over the future of NATO.
Although Trump backed down after a meeting with NATO Secretary-General Mark Rutte in which he said they formed the "framework" for a deal over Arctic security, trans-Atlantic relations have taken a hit.
His latest comments are unlikely to improve relations.
Diane Dernie, whose son Ben Parkinson suffered horrific injuries when a British Army Land Rover hit a mine in Afghanistan in 2006, said Trump's latest comments were "the ultimate insult" and called on Starmer to stand up to Trump over them.
"Call him out," she said.
"Make a stand for those who fought for this country and for our flag, because it's just beyond belief."
with Reuters and PA