Coup plotters failed to realize that coups against stable governments rarely succeed.

A successful military coup requires careful planning, masterful execution, and a good dose of luck.

All three ingredients were missing from Friday’s haphazard coup attempt in Turkey.  The coup appears to have been staged by a faction of estranged junior military officers determined to rescue Turkey’s democracy from an increasingly authoritarian government.  As coups go, the Turkish attempt will rank among the most incompetent in history, with the plotters severely miscalculating the monumental effort required to topple a stable government.  What’s worse, having failed at their costly adventure, the coup makers will embolden the very authoritarianism that they set out to destroy.

The coup was staged while President Recep Tayyip Erdoğan was vacationing in Turkey’s Southwest.  Taking advantage of Erdoğan’s absence, the coup makers launched their ill-fated attempt.  They announced, prematurely it turned out, that the government had been toppled, a “peace council” was running the country, and martial law was imposed.

Although the coup makers obtained some initial successes by seizing key bridges and media stations, these successes soon turned to failures, as reality refused to cooperate.  A defiant President Erdoğan appealed to the nation from his FaceTime app―ironic for a President who has long sought to censor the Internet―and called on his supporters to take to the streets.  The sounds of low-flying Turkish jets thundering in the Ankara sky were soon met with unscheduled calls to prayer from mosques, beckoning the faithful to heed Erdoğan’s call to action.

The coup failed with strange speed.  President Erdoğan returned to Istanbul to announce that the “government brought to power by the people is in charge.”  The clashes left at least 265 dead, and according to unofficial reports, more than 2,800 military officers were detained.  By early Saturday morning, President Erdoğan declared the coup attempt over, celebrating the triumph of democracy over anti-democratic factions within the military.  Every major party issued statements condemning the coup attempt.

In retrospect, several features of the coup attempt are noteworthy.  As an initial matter, the coup plotters would all fail Coup Making 101. The coup attempt was not only haphazardly planned and executed, with no real direction or coordination, but the coup plotters failed to realize that coups against stable governments rarely succeed. A coup becomes a possibility only when a government begins to grow weak and unstable.

But the Turkish coup attempt hit one of Turkey’s most stable governments in history.  Turkey has had its share of turmoil this year in the form of terrorist attacks and an influx of Syrian refugees in the millions, but President Erdoğan remains stronger than ever.  Although he has been growing increasingly more authoritarian, the fact also remains that he is a democratically elected leader.  As I discuss in my forthcoming book, The Democratic Coup d’État (Oxford University Press 2017), a coup is like chemotherapy―an extreme measure reserved for the extreme case of a fully authoritarian government unwilling to permit competitive elections.  As a result, the ballot box, not a coup, is the proper way to dislodge President Erdoğanfrom his seat.

Although many facts remain shrouded in mystery, the coup appears to have been a desperate attempt by junior officers who acted without sufficient support from the military’s top brass.  In academic jargon, this was a “non-hierarchical” coup.  These coups tend to be much riskier and unstable than their hierarchical counterpart executed by the military’s senior leadership.  The Turkish attempt was no exception.

The mastermind behind the coup remains unclear. Turks love a good conspiracy theory, and there have been wild, and certainly inconclusive, speculations.  Some argue that it was President Erdoğan himself who staged the coup as a hoax to solidify his authority.  President Erdoğan, in turn, has pointed the finger at Fetullah Gülen, an influential Islamist preacher living in self-exile in Pennsylvania with a loyal following in Turkey.  An alliance of convenience between Gülen and Erdoğan broke down in recent years, as Erdoğan blamed Gülen’s followers within the police and the military for a sweeping corruption investigation against Erdoğan and members of his Cabinet in 2013.  A clash of ideologies soon turned personal, locking the two men in an endless vendetta.

The debate about who planned the coup, and whether the coup was real or staged, is largely a red herring.  What’s far more important are the effects of the attempted coup on the future of Turkey’s democracy.  Although President Erdoğan and his supporters have hailed the foiled coup attempt as a sign of Turkey’s robust democracy, the coup is likely to spell further trouble for the already-fledging democratic system of Turkey.

For domestic and global observers alike, this is a time for vigilance, not celebration.  Here’s why.

Since assuming power in the early 2000s, then-Prime Minister and now-President Erdoğan has created a well-oiled political powerhouse that keeps his political opposition at bay through criminal prosecutions, libel lawsuits, and tax fines. In Erdoğan’s Turkey, the illusion of democracy is preserved because everyone can vote. Although his government mimics the rituals of democracy and echoes its rhetoric, this democratic window dressing conceals a very different reality.  Erdoğan has systematically eroded checks and balances on his powers, restructuring state institutions and packing them with his loyalists. With over 1,000 rooms, his massive presidential palace—constructed in brazen defiance of several court orders—is emblematic of his ever-growing authorities.

Emergencies tend to enable powerful politicians to fend them off.  With their survival and the country’s stability at risk, citizens may throw their weight behind a strong, charismatic leader despite glaring signs of illiberalism.

The failed coup attempt against Mr. Erdoğan may therefore turn out to be his finest hour.  He has emerged unscathed from a full-frontal confrontation with a powerful nemesis.  This is bound to embolden his already-insatiable appetite for power and his push to establish an “American style” presidential system in Turkey. His argument in favor of presidentialism, which his opponents argue will push the nation further towards dictatorship, rests in part on the need for a strong, central power in Turkey to fend off destabilizing threats.  The foiled coup attempt — a concrete manifestation of these threats — will only add fuel to that argument, with sweeping executive actions and purges of political dissents appearing all the more palatable. In fact, following the coup, Erdoğan did not waste time in initiating a widespread crackdown. At least 2,700 judges were removed from duty with little domestic opposition.

Before Friday, Turkish democracy was already teetering precariously on the brink of collapse.  The coup may have been the final straw that breaks the camel’s back.  For what doesn’t overthrow a power-hungry leader only makes him more powerful.