In the dying days of Boris Yeltsin's presidency, the great and the good in Washington scratched their heads and asked themselves: "Who lost Russia?"
Post-communist Russia was more fluid than the hordes of economists, missionaries and carpetbaggers who descended on Moscow in 1992 had ever imagined. But the question itself was salutary. Bill Clinton had indeed achieved a rare feat in the annals of US diplomacy: managing to turn a pro-western country into an anti-American one. How had he done it?
Joe Biden could well be asking himself a similar question as he flies to Turkey on Wednesday: Who is losing Turkey? The US has had a bad coup. In the first hours of 15 July, Secretary of State John Kerry hoped for "stability and continuity". It took two hours for the White House to issue an unambiguous statement mentioning democracy and the rule of law. That delay was enough to plant the suspicion in Ankara that its closest military ally knew more than it was letting on.
A nation in shock from the lethal force used by the coup plotters on that Friday night – 35 jets, 37 helicopters, 246 armed vehicles, 4000 weapons and three ships – soon found itself getting lectures on human rights.
Kerry linked concerns about the scope of Erdogan's purge of the army and administration to Turkey's continued membership of NATO. That line prompted a former US ambassador in Turkey to suggest that his Secretary of State was hallucinating. "What was he smoking?" James Jeffrey asked, as he wondered how the US would deal with Russia and Iran if the largest military force in the region was kicked out of NATO.
Centcom then discovered that its closest contacts in the Turkish military were being thrown into prison. 151 generals and admirals, a third of the generals in the Turkish military, have been rounded up – and the head of US Central Command wanted to know why. He even said the purge could disrupt the military relationship between Turkey and the US.
"What I'm concerned about is … first and foremost that it will have an impact on the operations that we do along that very important seam," Joseph Votel said. This prompted a furious response from Erdogan, and Centcom found itself quickly rowing back on that one.
Reports emerged daily in the Turkish media about the visits the coup plotters had made to the US. The movements of Adil Oksuz have attracted particular attention. A theologian teaching at Sakarya University, he was first arrested outside Akinci air base, from where the coup was masterminded. He had embarked on over 100 foreign trips since 2002, and most recently was in the US on 11 July before returning on 13 July.
Following his arrest, Oksuz was released by a judge and is now on the run. For the Turkish authorities, he is a prime suspect as one of the bag carriers for Fethullah Gulen, the self-exiled cult leader in Pennsylvania, whom Turkey accuses of being behind the coup plot.
All this has emerged before the opening salvo in the forthcoming legal battle over the extradition of Gulen has even been fired.
Russia, on the other hand, had a good coup. Iranian media claimed Russian military intelligence in Syria had picked up signals of the helicopter squad heading to Marmaris to assassinate Erdogan in his holiday villa and tipped off Turkish intelligence. He escaped by 15 minutes. However, Turkish intelligence had received reports of unusual troop movements several hours earlier.
Whether true or not, the story helped Putin in his attempts to pose as Erdogan's saviour. When the Russian bomber was downed by a Turkish jet, Putin said he had been "stabbed in the back" by his ally. All this was now history. Erdogan had already prepared the ground for a reconciliation by apologising for the incident, hinting that it had nothing to do with him.
When Putin and Erdogan met, Turkish briefers and commentators went into overdrive to emphasise what the two men now had in common. They stressed the meeting was about bilateral trade – TurkStream, the natural gas pipeline bypassing Ukraine and tourism – not the heavy-lift subjects on which the two countries remain at loggerheads: Syria, the Kurds and Iran.
I am not convinced this represents the whole truth.
Erdogan's problems with NATO, the US and its allies predate the coup. They all have to do with allegations that Turkey allowed IS fighters to transit into Syria and traded with IS, a claim made by Russia itself. In November last year Mohamed Dahlan, the exiled Palestinian strongman, told NATO policymakers at an Atlantic Treaty Association (ATA) security conference "to look themselves in the mirror".
"All Europe knows Daesh is dealing commercially with Turkey," he said, "look at yourselves in the mirror. You talk like Arabs did 40 years ago. Terrorism in Syria all comes through Turkey. You are complicating the issue."
This January, Jordan's King Abdullah told top US congressmen in a closed meeting that Erdogan believed in a "radical Islamic solution to the region". The king presented Turkey aspart of a strategic challenge to the world: "We keep being forced to tackle tactical problems against ISIL [the Islamic State group] but not the strategic issue. We forget the issue [of] the Turks who are not with us on this strategically." he said.
And Western intelligence agencies in Turkey have fuelled these claims of complicity with IS.
The MI6 station chief in Turkey briefed a British newspaper journalist about the links between Turkey and IS. The veteran investigative reporter Seymour Hersh, quoted by name Lieutenant General Michael Flynn, director of the Defence Intelligence Agency between 2012 and 2014, as saying that Turkey wasn't doing enough to stop the smuggling of foreign fighters and weapons across the border.
"If the American public saw the intelligence we were producing daily, at the most sensitive level, they would go ballistic," Flynn told me. "We understood Isis's long-term strategy and its campaign plans, and we also discussed the fact that Turkey was looking the other way when it came to the growth of the Islamic State inside Syria."
An unnamed adviser to the Joint Chiefs of Staff told Hersh: "American intelligence had accumulated intercept and human intelligence demonstrating that the Erdogan government had been supporting [al-Nusra Front] for years, and was now doing the same for Islamic State…We told him we wanted him to shut down the pipeline of foreign jihadists flowing into Turkey. But he is dreaming big – of restoring the Ottoman Empire – and he did not realise the extent to which he could be successful in this.'"
The killer sentence was this one: "We worked with Turks we trusted who were not loyal to Erdogan," the adviser said, "and got them to ship the jihadists in Syria all the obsolete weapons in the arsenal, including M1 carbines that hadn't been seen since the Korean War, and lots of Soviet arms. It was a message Assad could understand: "We have the power to diminish a presidential policy in its tracks."
Working with Turks "who were not loyal to Erdogan" has a more concrete meaning in the light of what happened on 15 July. The briefings that Hersh and others got are now being seen by Ankara as preparation for the coup.
Biden will have to work hard to persuade Erdogan that this is not the case, that the Turks they worked with who were not loyal to Erdogan were not the same Turks who tried, and narrowly failed, to assassinate him.
There is little likelihood of Turkey leaving NATO. When Putin bared his teeth after his Sukhoi bomber got shot down last year, it was to NATO that Turkey turned. An external military threat today would produce the same reaction.
But nor can Turkey be guaranteed to play the same role, especially on its sensitive southern border. The coup has two most likely effects. Firstly, that Erdogan will feel freer to act in Turkey's national interest in Northern Syria. He will not be constrained by the agenda, or the lack of it, set by the US. He will not feel subject to a US veto.
We have already seen the results of this in the advances by rebel forces in Aleppo. There could soon be other signs of this. Assad's bombing of US-backed Kurdish forces could not have happened without Putin's assent, and this too suited Turkey's red lines on its southern border.
The second effect of the coup will be on the army itself. A new army will be formed, not necessarily more Islamic, but certainly one that will do everything it can to display its loyalty to the Turkish state and to Erdogan himself. This was the message the army chief of staff gave to the biggest rally in Turkey after the coup. This post-coup army will be stronger and more assertive – certainly in Syria.
The tectonic plates of this conflict have shifted again, with or without NATO's or the Pentagon's assent. The US faces nowhere near as many challenges from its enemies in the Middle East as it does from its allies. And as Russia demonstrates, there is no more dangerous an ally than an ally scorned.
The views expressed in this article belong to the author and do not necessarily reflect the editorial policy of Middle East Monitor.