Turkey’s President Recep Tayyip Erdogan has emerged stronger than ever in the aftermath of the failed coup. He claims democracy triumphed on the shoulders of those who heeded his call to go to the streets where they braved tanks.

Western television commentators chuckled seeing him reduced to using Facetime to galvanise the nation to his defence, but the president is enjoying the last laugh. He says the coup was “a gift from God” permitting him to cleanse the military of “the gang”.

Over 6,000 judges, prosecutors, military officers and soldiers have been arrested for their part in Thursday’s failed coup, and, now designated traitors, will be subject to the full force of the law. The government is mulling reinstituting the death penalty, which, if implemented will set Turkey at odds with the EU and will scupper its hopes of EU membership.

A major purge of the military establishment and civil institutions is underway. Soldiers are being beaten and killed in the street by Erdogan’s supporters; one was beheaded. Others were arrested, stripped of their clothes and thrown, packed tightly, on the floor of a warehouse. The Armed Forces have been humiliated and defanged.

Within hours of tanks patrolling the streets, the announcement of a curfew and the plotters’ takeover of media outlets, Erdogan pointed the finger at his nemesis in self-imposed exile Fethullah Gülen, who retains a substantial following – some say many millions — in country and abroad.

Gülen is a moderate former imam straddling the Islamist and secular camps. His Hizmet Movement is often blamed for attempting to infiltrate the arms of government and the security apparatus. However, his movement’s US branch denies the president’s accusations and has denounced military interventions in domestic politics.

Turkey has informally demanded Gülen’s extradition. John Kerry says the US requires hard evidence and the request must be processed through legal channels. This could put a spoke in the wheel of Turkish-US relations. Turkey’s Prime Minister has warned, “Any country that protects Fethullah Gülen will be an enemy to Turkey.”

It’s no secret that Erdogan is eager to change the constitution so as to transfer prime ministerial powers to the presidency. And to this end, he pushed the former Prime Minister Ahmet Davutoglu to resign in favour of his loyal friend Binali Yildirim, who’s eager to cede powers to the president.

Turkey’s democracy has been eroded in recent years along with its economy that’s been undermined by the repercussions on tourism, trade and real estate from the downing of a Russian fighter jet, as well as a series of terrorist attacks. Needs must has recently propelled the president to bend his head in order to court both Russia and Israel with the objective of restoring broken relations.

Western heads of state turn a blind eye to their ally’s anti-democratic transgressions because Turkey is an important member of Nato; its armed forces ranking second in terms of force strength within the organisation. Moreover, it is strategically placed on the front lines of the Syrian conflict and, in theory, restricts the flow of foreign fighters and stolen oil.

More importantly, Turkey has agreed to be a buffer stemming the flow of refugees and asylum seekers from reaching the EU’s Mediterranean shores in exchange for billions of euros, visa-free travel to EU member countries for Turkish citizens and the re-energising of the country’s longstanding bid to join the EU. In other words, Ankara has western countries over a barrel.

The US treats Ankara with kid gloves because retaining access to its Incirlik airbase is considered crucial to its various regional war efforts. I can only wonder what signals from the White House were being sent to the coup’s orchestrators via backchannels and whether those messages were instrumental in persuading them to fold. The Twittersphere is abuzz with more cynical views postulating that the coup was a false flag, cooked-up by Erdogan himself.

Clearly, the young soldiers had not been instructed to fire on angry crowds of Erdogan’s supporters; many allowed themselves to be arrested by the police while others, their faces stricken with fear, gave up without a fight. A rebel fighter jet locked on to Erdogan’s plane but didn’t fire. Conscripts have told their interrogators they had no idea they were participating in a coup. They were given to believe they were taking part in a training exercise.

I would suspect there are many in Turkey who secretly hoped the coup would succeed but fear expressing their opinions in the current climate. There has been a growing, albeit quiet, clamour among moderates, secular youth, academics and the middle classes for a more secular, democratic government. That seems farther away than ever.

Erdogan’s popularity among all sectors has waned in recent years, yet he does retain the loyalty of up to 50 per cent of the population, especially the religiously conservative and the working classes which identify with the president’s humble roots.

One thing’s for sure, Erdogan is a shrewd operator and I would predict that now his grasp on power will fasten ever tighter. Perhaps democracy didn’t win after all! Time will tell.