On the night of July 15, 2016, an army faction disgruntled with Erdogan's one-and-a-half decades of domination sought to seize power.
TURKEY | COUP
Turkey marks one year on July 15 since a coup attempt aiming to topple President Recep Tayyip Erdogan that failed within hours but etched far-reaching consequences into its society and politics.
The country is in the throes of the biggest purge in its history against alleged coup supporters while Erdogan has seen his grip on power tightened rather than weakened.
But Turkey is also facing some isolation on the diplomatic stage, experiencing tense relations with the European Union and the United States, and now trying to limit the damage from an explosive crisis over its ally Qatar in the Gulf.
"One year on from the coup bid, President Erdogan is stronger than ever," said Ozgur Unluhisarcikli, Ankara office director of the German Marshall Fund of the United States.
But he added the crackdown has "unavoidably weakened Turkey's international standing particularly vis-a-vis Europe and the United States."
'Martyrs of July 15'
On the night of July 15, 2016, an army faction disgruntled with Erdogan's one-and-a-half decades of domination sought to seize power, closing the bridges in Istanbul, bombing parliament in Ankara and deploying tanks in the streets.
But the coup bid unravelled as Erdogan returned in triumph to Istanbul from holiday and tens of thousands of ordinary Turks poured into the streets to oppose the plotters.
Two hundred and forty nine innocent people died in the coup and are regarded as "sehitler" (martyrs for Islam).
The authorities see the coup bid's defeat as a victory for democracy and have renamed the Bosphorus Bridge in Istanbul that was a centre of the fighting the "Bridge of the 15 of July Martyrs".
Extensive commemorations are planned for Saturday including a speech by Erdogan on the bridge, with July 15 now declared an annual holiday, the Democracy and National Unity Day.
Turkey's longest night left a litany of images engraved into the memory -- the tear-stained face of the state TV presenter forced to make a statement by the coup plotters, or Erdogan peering out through the FaceTime app as he made a live appeal to supporters.
Erdogan swiftly said that the coup bid was masterminded by his one time ally turned nemesis, the US-based Islamic preacher Fethullah Gulen who over decades assiduously built up influence in the judiciary, police and the army.
From his secluded base in Pennsylvania, Gulen denied the charges. But Erdogan vowed to wipe out the "virus" of Gulen from Turkish institutions.
Turkey subsequently embarked on the most extensive crackdown in its modern history, arresting over 50,000 people and sacking 100,000 more from their jobs.
Critics say the state of emergency imposed last July 20 -- which remains in place -- has been used to go after all opponents of Erdogan, including critical journalists, activists and pro-Kurdish politicians who opposed the putsch bid.
After landing in Istanbul in one of the turning points of the July 15 coup bid, Erdogan described the attempt as a "blessing from God" and critics have accused him of opportunistically exploiting the events.
On April 16, Erdogan narrowly won a referendum that from 2019 will grant him sweeping new powers and also allow him to resume his leadership of the ruling Justice and Development Party (AKP).
"His control over the AKP is absolute and as a result of the atmosphere of fear created through the post-coup attempt purges, his control over the bureaucracy, private sector and media are tighter than ever," said Unluhisarcikli.
'Betrayal burned the heart'
Turkey's modern history has been littered with repeated interventions by the once all-powerful military, including the 1960 coup that led to the execution of then prime minister Adnan Menderes, Erdogan's political hero.
The July 15 bid marked the first time in Turkey's history a military coup had between thwarted and Erdogan rapidly put the military more under his direct control.
Around half of all Turkish generals were either arrested or fired after the coup bid.
The coup's defeat even spawned an officially-approved anthem that blares out at Erdogan rallies: "On the night of July 15, the weather was hot/ An attempt of betrayal that burned the heart".
Yet questions remain over the timeline, with testimony indicating the army received intelligence of a possible uprising as early as the afternoon of July 15.
But Erdogan, who was holidaying in the resort of Marmaris, found out about the plot so late that, according to his own statements, he was just 15 minutes from death.
"Although it is nearly one year after the coup, it does not seem easy to close the discussion over the intelligence aspects," wrote a columnist for the Hurriyet daily, Sedat Ergin.
As a NATO member and EU candidate, Turkey lamented the lack of American and European solidarity, with Ankara seeing Brussels as more fixated on the ensuing crackdown than condemning the attempt to oust the democratically-elected government.
Tensions rose between Ankara and Washington over the failure of the US to extradite Gulen, with the new administration of Donald Trump dashing hopes of any shift.
By contrast Russian President Vladimir Putin was quick to back Erdogan, helping seal a rapprochement.
But in the Gulf, Turkey was last month disturbed by the Saudi-led sanctions slapped on Qatar, its main ally in that region.