Dead civilians and thousands fleeing the fighting – Turkey’s attack on the Kurdish enclave of Afrin is a new and unwelcome phase in Syria’s seven-year war, but one that was widely predicted. The only surprise is its spectacularly inappropriate name, Operation Olive Branch. Ankara’s antipathy to the prospect of an autonomous or independent Kurdish state is longstanding. But the conflict is supercharged by the ambitions and jockeying of the various powers with their hands in this crisis.

“My enemy’s enemy is my friend” is a maxim of short-term convenience, not long-term commitment. The US needed the Kurdish-dominated Syrian Defence Forces to take on Islamic State – particularly given Turkey’s lack of interest in assisting until late in the day. Ankara grudgingly tolerated the situation and sought to contain it. But with the collapse of Isis’s so-called caliphate, the kaleidoscope has shifted, and the fact that “my ally’s ally is my enemy” is in focus again.

The Kurds hoped to establish a corridor along the north-western border with Turkey and believed their contribution to the fight against Isis helped make the case for a self-governing region within a federalised Syria. Turkey’s hostility to those territorial ambitions has been inflamed by the US’s patronage – not least because it fears those weapons could be turned upon its citizens, since it regards the Kurdish militia and the party backing it as the Syrian wing of a terror group which has fought a long insurgency in Turkey. The US announcement of plans for a 30,000-strong SDF-based “border force” was described as a “terror army”by the Turkish president, Recep Tayyip Erdoğan. The last straw was the US secretary of state’s remarks that American troops would remain in Syria indefinitely, effectively offering a military guarantee to the Kurds.

America’s goals are to prevent Isis cells re-emerging in liberated areas, and to maintain influence in the region, resisting Moscow’s attempts to stitch up a Syria settlement. Washington has upped the pressure by holding Russia responsible for gas attacks on civilians. But despite its multiplying differences with Ankara – particularly following 2016’s failed coup, and the refusal to extradite the cleric that Mr Erdoğan blames for it – it needs to keep its Nato ally onside.

Last month Mr Erdoğan denounced Bashar al-Assad as a terrorist mass murderer with no place in Syria’s future – hardening a position which appeared to have softened recently. But Turkey and Iran are co-sponsoring Vladimir Putin’s Syrian dialogue this month, which western countries fear could be used to outflank the UN process and reach a deal leaving Mr Assad in place. Mr Erdoğan’s relations with Mr Putin are better than ever, after the nadir of 2016, when Turkey shot down a Russian jet. Moscow moved personnel from Afrin and allowed the Turkish strikes in airspace it controls. For the Kremlin, what’s not to like? As well as pushing forward its own deal, it sees a chance to influence the Kurds, who have tilted towards the US, and to enlarge divisions within Nato. It may also be keeping Mr Assad on his toes.

Mixed and contradictory messages from the US administration are making matters worse, but the underlying problem is that so many parties are pursuing such complex and conflicting ambitions. While the US and Turkey may yet reach a deal for the sake of their own interests, the prospects of a solution are at least matched by the risks of further destabilisation in a tormented region. Everyone expected this to happen. No one knows how it will end.