ISTANBUL, Turkey – Support from the highest echelons in the army helped keep President Recep Tayyip Erdogan in power after the failed coup but Friday's events risk further undermining the military's status as a key player in Turkish politics.
Relations between Erdogan and the Turkish army have often been strained, but he can thank the top brass – as well as the mass mobilization of his own supporters – for seeing off the threat.
Turkey has detained 103 generals and admirals as well as more than 2,800 soldiers accused of supporting Friday's attempted power grab, but most of the military's senior figures stayed loyal to Erdogan.
These included chief of staff General Hulusi Akar who was taken hostage by the coup plotters in a terrifying ordeal.
"The coup d'etat was foiled thanks to an alliance between Erdogan and the secular arm of the army," said Fuat Keyman, director of the Istanbul Policy Center.
'Army chief refused to sign'
Erdogan has reached out more to the armed forces since he fell out with erstwhile ally Fethullah Gulen, an Islamic preacher now living in the United States, whom the Turkish leader blames for the attempt to topple him.
Ironically, Erdogan, who came to power in 2003, allied himself with Gulen in order to rein in the military deemed to be the main threat to his Islamo-conservative government.
The armed forces are considered the guardians of the secular Turkish state created in 1923 by Mustafa Kemal Ataturk, ready to act when the mainly Muslim nation's government takes on a religious hue.
The army led successful coups in 1960, 1971 and 1980 and was also behind the ouster in 1997 of Islamist prime minister Necmettin Erbakan, a political mentor of Erdogan, in a bloodless coup.
But when the putschists were trying to overthrow Erdogan, dozens of senior officers, including generals, rushed on to television channels to denounce the move.
Akar was held hostage for 20 hours during the coup attempt. He refused, despite a pistol held to the head, to sign a declaration that the rebel leaders had taken power, according to comments given to NTV television.
He was applauded and cheered as a national hero by lawmakers when he attended an extraordinary session of parliament after the foiling of the coup.
'Marriage of convenience'
Analysts say the rapprochement between Erdogan and the military came about for two reasons – hostility to Gulen and the renewal of the Kurdish conflict in the southeast.
Kurdish rebel attacks against Turkish security forces have intensified with almost daily attacks since the collapse of a two-and-a-half-year ceasefire last July.
For Professor Jean Marcou of France's Sciences-Po university, the new relationship between the head of state and the army is a "marriage of convenience".
The alliance was on display in April when Turkey's highest court quashed the 2013 convictions of dozens of senior army officers for allegedly trying to overthrow the government.
The Turkish authorities said Gulen -- who wields enormous power with supporters in the media, judiciary and police -- was behind that bid.
Retired General Ilker Basbug, a former chief of staff who was jailed for life under the original ruling, on Sunday denounced the "action of the putschists" and said he hoped the army would emerge stronger.
'Devastating for army'
But Friday's events have more likely provided Erdogan with the chance to again clip the wings of the armed forces.
The army now risks losing its role as a political actor and becoming more of a traditional purely military force, said Marcou.
Erdogan could meanwhile beef up the role of the police, who were massively opposed to the plotters and had already been growing in power.
"The videos of men in uniform attacking civilians are devastating for the army, which is now going to have to work hard on its image," said Keyman.
After having supported Erdogan, the army could present itself as "not just the guardian of secularity but also of democracy," he added.
Any sanctions against the army, which is fighting both the Kurdish rebels in the southeast and bombarding Islamic State jihadists in Syria, could have a serious impact, and not just at home.
French Foreign Minister Jean-Marc Ayrault on Sunday questioned Turkey's "reliability" in the fight against Islamic State in the wake of the abortive coup. – Rappler.com