The Islamic State caliphate is dying a well-deserved death. This spring, Mosul in Iraq and Raqqa in what used to be Syria will fall. Across the summer, remaining outposts will be purged of the Islamist movement’s remnants. Isolated terror attacks will continue, but the physical caliphate will be erased.

And after ISIS itself, the biggest loser will be the United States.

Defeating ISIS is a worthy goal, but the rivalries of blood and faith that will poison the post-caliphate landscape are emerging. Turks alternately confront and accommodate Russia. Our most-effective combat partners, the Kurds, infuriate Turkey and worry local Arabs. Arab factions fight among themselves (as do the Kurds on occasion). Alphabet-soup minorities suffer and flee.

Russians kill and watch. Iranians kill and wait. Their client, Syrian leader Bashar al-Assad, has amassed a tally of war crimes that makes his survival “unthinkable.” Yet he’s likely to retain power.

With ISIS defeated, we won’t be needed. We’ll be shown the door — except, of course, for aid money.

Uneasy coalitions will collapse. Iran — a k a Persia — will have a client state on the Mediterranean for the first time since the Classical Age. Turkey’s Islamist strongman, President Recep Tayyip Erdogan, dreams madly of a renewed Ottoman empire (which no Arab desires). And Vladimir Putin is set to reap a huge return on a minimal investment.

Fifty million Kurds, longing for independence and freedom, will be embattled on multiple fronts — and, perhaps, deserted by the United States to serve Foggy Bottom fantasies of preserving obsolete states (Iraq and Syria) that have outlived their old and unjust purposes.

Meanwhile, our military serves our enemies by applying our power against ISIS without a practical vision for the day the caliphate falls.

In the Levant and Mesopotamia, history’s the quarrelsome neighbor forever banging on the door. The Arab-populated expanse was ruled, brutally and incompetently, by the Turkish Ottomans for centuries. When that empire collapsed after World War I, control fell to British and French schemers. The British sought security for the Suez Canal, their lifeline to India. And they wanted that strategic commodity, oil.

The French wanted to keep up with the British. So the two powers split the Middle East, drawing artificial borders that ignored local demographics and old hatreds.

The Brits carved out Iraq and Jordan for their puppets and acquired the Palestine Mandate (where Israel would be reborn, a rare instance of justice). The French got control of Lebanon and Syria. The Kurds were cheated, the Armenian genocide ignored and the Shia overlooked, while lesser minorities didn’t even register.

The result was the emergence of phony states that crammed together peoples and confessions that hated each other while dividing groups (such as the Kurds) who yearned for unity, freedom and independence. And when the European empires faded, only dictators could hold the unnatural states together. By committing ourselves to the maintenance of those deadly, dysfunctional borders, the United States leapt flat-footed into the quicksand.

In 2003, in Iraq, we had the chance to begin dismantling those phony states in favor of justice and common sense, but inertia and short-term fears defined our diplomacy. We didn’t liberate Iraq — we perpetuated it. Now, 14 wretched years later, we continue to pretend that, magically, Iraq can achieve political health and that Syria should be preserved with a new head of state.

We have taken the side of dead empires and injustice.

What should we do? Discard our preconceptions for a start. Why shouldn’t dysfunctional borders change? In fact, they’re changing themselves. How many American lives is it worth to serve the vision of dead Europeans and grisly Arab dictators? We need not act to change those borders, but we shouldn’t stand in the way.

The destruction of the ISIS caliphate won’t end terrorism, but the Islamists will suffer a powerful practical and psychological blow. The terrorists eventually will adapt, but their appeal will be weakened: Angry young men want to join a winning team, not a bunch of losers.

Still, the rise of ISIS was unnecessary. Enchanted by the neocons, the George W. Bush administration made Iraq far harder than it had to be simply by not planning for the worst. Then President Barack Obama threw away our hard-won progress in Iraq and, tragically, cowered and prevaricated while the all-but-doomed Assad regime recovered its balance in Syria.

Now we face a new Iranian empire, an expansionist Russia, a treacherous Turkey, an Iraq lost to Iran and the prospect of years to come of ethnic cleansing, massacre and violent uprisings on which terrorists will again piggyback.

Can the Trump administration design and execute a Middle East strategy that actually works to our benefit and makes sense? If so, it would be the first since the Truman presidency.