Despite its checkered history of military meddling in politics, Turkey seemed in the past decade to have moved away from the darkness of military coups. Yet on July 15, many Turks watched with horror a televised coup attempt. Although it unraveled within hours, it triggered a bitter debate on the future stability of this NATO ally and key actor in the ongoing fight against the self-styled Islamic State.

The coup attempt is widely understood as having been orchestrated by the followers of Fethullah Gülen, a recluse Islamic cleric based in the United States, to overthrow the Turkish government. The timing is understood to be linked to the meeting of Turkey’s Supreme Military Council in August 2016, when many Gülen-affiliated officers were to be purged from the military top brass. This claim would make the Gülenists a uniquely destructive nemesis of the Turkish army.

Gülenists were seen as responsible for the now-overturned judicial proceedings of the last few years, Ergenekon and Sledgehammer, that were used to defang and decapitate the Turkish military on the basis of a core of fabricated evidence. With the latest coup attempt, the Gülenists brought more damage to this institution, which will have difficulty in recovering its tarnished cohesion, integrity, and popular prestige.

The failure of the coup can nonetheless be explained by three factors. First, the coup plotters were operating outside the military chain of command. As a result, they failed to muster sufficient military resources to succeed in their ill-considered objective. Yet even with a range of tanks and fighter planes at their disposal, they were able to create a significant risk for the government. The bombing of the Turkish parliament will remain the most egregious episode of their skewed adventurism.

Second, the overall tactical blueprint for the coup was surprisingly ineffective. The junta leaders failed to take control of key political and security institutions in Ankara.

But the most important element that tilted the balance against the coup plotters was the overwhelming response of Turkish society. The success of past coups and, especially, of the 1980 military intervention was essentially due to overarching support from the Turkish people, who had confidence in the institution of the military to end the days of terror and anarchy that were prevailing at the time.

This time, however, the popular reaction proved vastly different. All political parties and civil society organizations, including antigovernment media institutions, took a clear stance against the coup attempt. It is to be emphasized that these groups came out against the coup when it wasn’t clear which way it was going to go. It is the emergence of this strong solidarity against the military intervention that constituted the most effective bulwark against the aspirations of the military plotters.

This strong will for collective action also transformed the perception of the coup, which therefore cannot be seen in the simplistic framework of a secularist military intent on bringing down an Islamist government. The emergence of this clear and unambiguous pro-democracy coalition not only overcame the threat of the tanks but also constitutes the real window of hope for the future of Turkish democracy.

The short-term consequences of this coup attempt can evolve in one of two directions. Turkish President Recep Tayyip Erdoğan and the ruling Justice and Development Party (AKP) may seek to leverage their success in foiling this attack on democracy by advancing their agenda of a shift to a presidential system. This would take the form of a snap parliamentary election, with the hope that the ruling party would win significantly more seats in the new parliament to ease the transition to presidentialism.

But this path is riddled with difficulties, as the idea of a presidential system continues to create polarization in Turkey. It is unclear whether the country can sustain its ever more acute cleavages for much longer. Win or lose, such a proposition would create conditions similar to the political aftermath of the British vote to leave the EU.

The alternative is to seize this unique and unalloyed moment of political collusion to rejuvenate the momentum for democratic reforms. The strongest argument that could possibly sway Erdoğan in this direction is that Turkey that can ill afford a sustained period of instability and acrimony given the enormity of its very real security and political challenges.