WASHINGTON — A former top Marine officer who led special operations troops in the fight against ISIS is denouncing President Donald Trump's decision to pull American troops out of Syria amid a Turkish attack on the Kurds, saying it amounts to a betrayal of allies that will harm U.S. national security.

Andrew Milburn, a Marine colonel who retired in March as the deputy commander of U.S. special operations forces in the Middle East, told NBC News that the small number of U.S. troops in Syria "bought us a lot for a very low price."

"By withdrawing these guys, who knows where this will end," said Milburn, who is one of the few prominent battlefield veterans of the ISIS campaign to express on the record what many current and former soldiers have been saying privately.

"As a guy who has fought [alongside] the Kurds," he said, "on an emotional level this is gut-wrenching."

Milburn took issue with the comments of Defense Secretary Mark Esper, who said Sunday that President Trump had no choice but to pull out American troops because they were caught between two hostile forces.

The president, Milburn said, could have prevented Turkey from moving forces into Syria by threatening consequences. Trump ordered a partial U.S. withdrawal after an Oct. 6 phone call with Turkish president Recep Tayyip Ergogan. On Sunday, Esper said Trump had directed all U.S. troops to leave northern Syria.

"Trump definitely could have stopped it from happening," Milburn said of the Turkish incursion. "We've stopped the worst of Turkish territorial ambitions in the north a number of times" by threatening to respond with force to any Turkish attack on the Kurds.

In voicing public criticism, Milburn was echoing arguments made by foreign policy experts and politicians from across the political spectrum, from Brett McGurk, who was special envoy for countering ISIS under Presidents Obama and Trump, to Senate Majority Leader Mitch McConnell, R-Ky., who said in a new statement Monday that "Abandoning this fight now and withdrawing U.S. forces from Syria would recreate the very conditions that we have worked hard to destroy and invite the resurgence of ISIS."

But Milburn's comments are particularly resonant coming from someone who risked his life with Kurdish militias on the battlefield against ISIS.

Army Gen. Joseph Votel, who retired in March as head of U.S. Central Command — and who oversaw Milburn's troops — used more measured language last week, telling Military Times that he was "disappointed in this policy decision," and that the Kurds "have been exceptional partners and we would have not been successful against ISIS in Syria without them."

Having worked with Kurdish forces in Iraq, Milburn says he feels awful that Syrian Kurds have been left at the mercy of a superior Turkish force armed with American weapons.

Abandoning them, he said, will cost the U.S. "the last vestige of credibility we had in the region," because the U.S. relied on Kurdish militias to defeat ISIS and gave them an implicit guarantee that they could live peacefully in a semi-autonomous region.

But even leaving that issue aside, he said, from a geopolitical standpoint the withdrawal makes no sense.

It will empower Russia and the Syrian regime and set the stage for a resurgence of ISIS, he said, echoing the view of current and former intelligence officials.

"Whichever way you look at it, we have created greater volatility, and that is not in the U.S. national interest," he said.

Before he became deputy commander of special operations command in Tampa, Florida, Milburn, who holds a law degree, commanded U.S. and allied forces in Iraq, where he helped lead the effort to take back Iraqi territory seized by ISIS.

He noted that there have been fewer than 20 American personnel killed in the ISIS campaign, as against thousands of Kurdish fighters.

"Using the Kurds as a proxy has saved us significant resources in terms of lives," he said.

President Trump has defended his decision on Syria as fulfilling his campaign promise to get America out of what he calls "endless wars" in the Middle East.

In a new statement Monday, Trump said he would sanction Turkey, adding that its military offensive is "endangering civilians and threatening peace." But Trump also defended his decision to withdraw U.S. troops. He said a small garrison will remain in Southern Syria "to monitor the situation" and prevent the resurgence of ISIS.

Experts who defend his decision point out that the U.S.-backed Kurdish forces had connections to the PKK, a Kurdish separatist group that has fought a decades-long insurgency against Turkey and has been designated a terrorist organization by the U.S.

There always was going to be a day of reckoning with Turkey, they say, and the U.S. could not protect the Syrian Kurds forever.

Milburn and other critics say that could have been worked out politically, and they dispute allegations by the Turks that Syrian Kurds were mounting terror attacks from the border.

"I think we could have brokered a political understanding with the Turks where we could have supported the security of the Turkish border," Milburn said.

He added that in conversations on social media, he is seeing anguish about the decision to withdraw troops from Syria among the special operations community. A former operator who spoke separately to NBC News confirmed that.

"Among SOF [special forces] guys who served there," Milburn said, "There's absolutely opposition to what has happened."