When US president declared war over he upended consensus to see off threats of Iran and Isis

As Islamic State crumbled over the past two years, US generals and spies gradually turned their attention to what comes next. Ahead of all other perceived threats – even the residual menace of the jihadists themselves – was the entrenchment of Iran in the vanquished lands of Iraq and Syria.

The consensus among the US security establishment was almost universal: Washington’s forces needed to stay in eastern Syria to see off both, and that the task may be just as long and grinding as the fight against the terror group.

That conclusion, so central to US orthodoxy on Tuesday was by Wednesday night redundant when Donald Trump overrode the objection of his closest advisers to declare the war over. In doing so, he upended a strategy that he himself had heavily invested in – stopping Iran ahead of all else. The implications will reverberate for years.

Who led the Isis battle had remained a point of contention throughout the four-year campaign. The US had stuck to its Kurdish proxies, viewing them as a safer bet than allying with the tribal structures of eastern Syria, and deflecting Ankara’s vehement complaints by pointing to results.

Isis no longer exists as an entrenched entity on Syria’s north-east. Though ravaged and abandoned, the area’s towns and cities would eventually welcome back its exiles, and keep the group at bay, or so the thinking went.

Buoyed by US weapons and patronage – and continuing presence – the Kurds could then turn their attentions to Iran, whose attritional creep has implications well beyond the border areas.

Deterring Iran from securing a foothold in Syria and consolidating 15 years of gains in Iraq had been the central plank of US foreign policy. An emboldened Tehran could pose a serious threat to Israel – a watertight ally of Donald Trump – and make things even more difficult for the US president’s other regional partner, Saudi Arabia.

In recent months, moves to counter Iran had taken shape, primarily through the reimposition of a sanctions programme that had been lifted by Barack Obama as he pushed for the now defunct nuclear deal. Squeezing Iran’s economic interests had been Washington’s primary tool. And here’s where Turkey came in. At odds through much of the Isis war, Ankara has had a constructive relationship with Iran, importing gas and oil that serves a large chunk of Turkey’s energy needs and offering Tehran political cover at several important moments.

Since August, shifting Turkey away from Tehran’s orbit had been a preoccupation of US efforts to squeeze Iran. Trump’s decision to withdraw followed a series of concessions by Ankara and Washington that have demonstrably cleared the air.

In October, Turkey released a US pastor detained for two years on terror charges. And later that month, Ankara agreed to curb Iranian oil imports – a significant move that was well received by Trump and his aides.

US sanctions were lifted on several Turkish citizens, and a six-month sanctions waiver offered to wean Turkish energy interests off Iran. On Monday, three days after Trump and the Turkish leader, Recep Tayyip Erdoğan, spoke by phone, Ankara pledged $3.5bn (£2.75bn) to buy US patriot missiles.

Then came the announcement. Erdoğan has said that Trump will not stand in the way of a Turkish push into Syria’s north-east, and without US forces in the way, nor could he.

Gaining control of the Syrian frontier from the Euphrates river to the Iraqi border would be a huge strategic gain for Turkey, and Trump appears to calculate it might be enough to drag Ankara away from Tehran.

Trump has in effect switched horses from the Kurds to their arch-foe the Turks. And in doing so, he has doubled down on a new phase in the regional war, the essence of which is letting Isis off the hook in order to take on a more pressing enemy.

With no US troops there to press the issue, he will be relying on countries less invested in such an outcome. Russia will be left as the last major international interlocutor in the region, greatly boosting its relevance. Iran will face no opposition to its vital strategic goal of consolidating as a land corridor to Damascus and the Mediterranean. And Isis, the raison d’etre for the chaos in the first place, will live to regroup and regenerate.