The national media blasted President Trump’s withdrawal of 50 US military advisors from the Syrian border with Turkey as a “sellout,” a “betrayal” and a “huge strategic blunder.”

Let’s be clear: None of them truly care about the Kurds. Otherwise, they would have been sending correspondents and camera crews to Rojava, as the Kurds call northern Syria, on a regular basis.

Let’s also be clear about the goals of Turkish president Tayyip Recep Erdogan. While he attempted to stylize his military invasion of Rojava as a counterterrorism operation, few international observers bought into it. Why? Because there have been no terror attacks against Turkey from Syrian territory since the Syrian Kurds established their self-governing entity in 2012. None.

Erdogan is not even remotely interested in fighting ISIS, or in taking responsibility for the estimated 12,000 ISIS fighters currently in Kurdish custody at the al-Hol refugee camp. What actually happens to those ISIS prisoners, and the fate of Christian and Yazidi minorities, will be key measures of the agreement hammered out by Vice President Mike Pence and Secretary of State Mike Pompeo with Erdogan on Thursday.

The humanitarian disaster that unfolded this past week helped to paint Erdogan as notorious a mass murderer as Saddam Hussein. And it was to Erdogan’s legacy that the president appealed in his private, and now public, letter to the Turkish president as the crisis unfolded.

Erdogan’s real goal with this invasion was to smash Kurdish self-government, and those 50 US advisors were the last thing in his way.

But let’s be clear about US goals, too. Our advisors were not in northern Syria to defend a Kurdish government but to fight ISIS. The fight to smash the ISIS caliphate is over, and we won.

No US administration has ever bought into Kurdish national aspirations. Even the pro-Kurdish ex-Secretary of State Rex Tillerson, who was a long-time investor in Kurdish oil, warned Iraqi Kurds to cancel a planned referendum on independence in September 2017.

When Kurdish Regional Government president Masoud Barzani defied those warnings, Tillerson said the results “lacked legitimacy” and warned there would be serious consequences. And the United States did nothing when Baghdad sent troops to the Iraqi city of Kirkuk shortly after the vote, then arrested the Kurdish governor-general and reclaimed control of the northern oil fields. That was a huge strategic setback for the Iraqi Kurds.

I have met with Kurdish political and military leaders in the region, including the PYD, the political arm of the Kurdish YPG militia. And while they were thrilled to have US backing in the fight against ISIS, none of them had any illusions about the US coming to their aid should Turkey attack.

Did the president’s critics really believe he should have considered those 50 US soldiers as a “tripwire” that would trigger a massive US military invasion of Syria to fight against Turkey — our NATO ally?

The president has taken concrete, immediate steps to shame and to punish Erdogan for his outrageous violation of the North Atlantic charter, which calls on member states to “settle any international disputes in which they may be involved by peaceful means … and to refrain in their international relations from the threat or use of force in any manner inconsistent with the purposes of the United Nations.”

The president on Monday unleashed new sanctions against Turkish officials and government entities, imposed stiff tariffs on Turkish steel exports to the United States and called off talks on a $100 billion trade deal.

On Tuesday, the Department of Justice unveiled a criminal complaint against Turkey’s state-owned Halkbank for allowing Iran to buy billions worth of gold using frozen oil money, violating economic sanctions. The complaint makes clear that senior government officials — possibly including Erdogan himself — took enormous bribes in exchange for allowing the scheme to continue.

Those sanctions — and the threat of more sanctions — paid off and forced Erdogan to back down.

The Kurds are paying a heavy price in this battle — not because of a US betrayal — but because they remain stateless and thus powerless. By targeting Erdogan financially, legally and undermining his legitimacy, President Trump has done more to help the Kurds than his critics with their crocodile tears. And for now, he is winning.

Kenneth R. Timmerman is the best-selling author of “ISIS Begins: A Novel of the Iraq War.” He lectured on Iran at the Pentagon’s Joint Counter-Intelligence Training Academy from 2010-2016.