The war in Syria is reaching a climax. The Syrian army, supported by Russian bombers, is advancing north of Aleppo to cut off the Syrian armed opposition from the Turkish border. The Syrian Kurds, backed by US air strikes, are closing in on Isis and non-Isis supply lines in the same area. In the wake of the bomb in Ankara on 17 February that killed 28 people, Turkey is threatening military intervention in Syria in retaliation for the attack. On Friday, President Barack Obama spent one hour and 20 minutes on the phone to Turkish President Recep Tayyip Erdogan, urging restraint.

“The Turks and the Saudis are always trying to nudge the US into sending ground troops to Syria, but they are not going to launch a large-scale military intervention on their own,” said a former senior diplomat in the Middle East. Turkish and Saudi policy on Syria has hitherto been full of threats and bombast, but it is dangerously mercurial and some form of military action cannot be ruled out, even if it is opposed by the US or Russia.

The US knows that Turkish military action would be directed primarily against the Syrian Kurds and the People’s Protection Units (YPG) that have been America’s most effective ally fighting Isis. In his conversation with Mr Erdogan, Mr Obama is reported to have said that the YPG should not seek to exploit recent gains by the Syrian army north of Aleppo to take more territory. But at the very moment that the two men were speaking, the success of US-YPG co-operation was underlined by a little-reported victory in north-east Syria, where the Syrian Democratic Forces, a proxy for the YPG, captured the important Isis stronghold of Shadadeh with the help of US air strikes.

There is a further reason why the US would be loath to give up its military alliance with the Syrian Kurds. “Over a year ago, the Americans realised that the Turks were not going to close their border with Syria to Isis and other jihadis on its northern, Turkish side,” said the former diplomat. “So the Americans decided to close the border on the southern side, with the help of the Syrian Kurds.” It is this plan which is now close to fulfilment.

President Obama’s policies in Syria since the rise of Isis in the summer of 2014 have always made more sense than critics supposed. Prior to the fall of Mosul, the White House had miscalculated the degree to which the Syrian war could left to fester without destabilising the rest of the region. Mr Obama unwisely compared the movement that became Isis to a junior basketball team seeking to play in the big leagues.

Ankara Bomb site

But Mr Obama has a far more acute sense than most other politicians about the ease with which the US, or any other foreign power intervening in Syria, Iraq or Afghanistan, can become plugged into local confrontations and disputes. I once asked General David Petraeus, the commander of the 101st Airborne Division in Mosul in 2004, what was the most important advice he could give to his successor. He said, after reflecting for some moments, that his advice would be “not to align too closely with one ethnic group, political party, tribe, religious group or social element”.

This approach is sensible, though scarcely feasible, because a foreign power under pressure acquires local allies where it can find them without inquiring too closely into their character and motives. For instance, Turkey has pushed for the US to support “safe havens” for displaced people and moderate armed opposition in northern Syria. This sounds benign and even humanitarian until one realises that the idea is directed primarily at stopping the Kurds from controlling more territory, and that the Turkish definition of “moderate” appears to include extreme jihadis such as Ahrar al-Sham that usually fight in alliance with the al-Qaeda affiliate, Jabhat al-Nusra.

Russian Foreign Minister Sergey Lavrov and US Secretary of State John Kerry give a press conference in Munich. The Americans and the Russians are today crucial military players in Syria (Getty)

It is right to be sceptical of “tail-wags-the-dog” explanations in which big powers shift the blame for their more culpable actions to local allies. But it also true that one of the main reasons for the disastrous outcome of foreign interventions in Libya, Iraq and Afghanistan since 2001 is that they have been justified as actions against a much-demonised enemy and in favour of an over-praised, moderate, secular opposition which did not exist.

In Iraq in 2003, the US dissolved the Iraqi army; this is often recalled as a foolish and unnecessary act by the head of the US occupation, Paul Bremer, which had the disastrous consequence of alienating the Sunni officer class and promoting the rise of al-Qaeda in Iraq. But I was in Baghdad at the time and, in reality, the dissolution of the army was being recommended to the Americans by the Kurdish and Shia leaders, representing 80 per cent of Iraqis, who rightly saw the Iraqi security forces as the most important institution through which the 20 per cent Sunni minority had traditionally held power. The Americans and allies such as the British were unwittingly presiding over a sectarian and ethnic revolution which was bound to have explosive consequences.

Skip forward 10 years to the poison gas attack in Damascus in August 2013, when the US and Britain almost intervened militarily against the Syrian government. In retrospect, this is recalled as the moment when a chance was lost to back a moderate armed opposition in overthrowing President Bashar al-Assad. In fact, the Syrian army controlled most of the populated parts of the country at the time, so any foreign air campaign would have had to be sustained along the same lines as Libya. And the outcome would have been similar to Libya as well, since Isis, al-Nusra and other jihadis already dominated the armed opposition and would have taken power.

Ankara explosion: 'car bomb' hits Turkish capital Show all 8 1 /8 Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion People react near the site of the blast Getty Images Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion Emergency services at the scene following a reported car bomb detonation. The attack targeted a convoy of military service vehicles EPA Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion Smoke rises over buildings following the explosion in Ankara. Getty Images Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion Turkish police officers close a street after an explosion in Ankara Reuters Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion Firefighters try to extinguish flames following the explosion Getty Images Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion Turkish police officers block a street after an explosion in Ankara, Reuters Ankara explosion: 'car bomb' hits Turkish capital Ankara explosion A fire engine stands at the site of the explosion Getty Images

Mr Obama evidently realised this at an early stage, and has shown understandable impatience at what became almost conventional wisdom among politicians and the media. He said in 2014 that the idea that there was ever a moderate opposition “in a position to suddenly overturn not only Assad but also ruthless, highly trained jihadists if we just sent a few arms is a fantasy. And I think it’s very important for the American people – but maybe more importantly, Washington and the press corps – to understand that.” It would be interesting to know if Mr Obama’s thoughts on David Cameron’s famous “70,000 moderate fighters”, whom Britain supports, are equally scathing.

The Syrian uprising or war has passed through three phases: a short period in 2011 when local forces determined what was happening in the country; 2012 to 2014 when regional powers such as Turkey, Saudi Arabia and Iran played a dominant role; and 2014 to 2016 when the conflict became internationalised. Three events marked the last period, in which the US and Russia became the decision-makers: the rise of Isis in 2014; the consequent start of the US air campaign; the beginning of the Russian air strikes a year later.