"The Turkish Army Topples Erdogan", said the red headline of Al-Ahram's front page, the leading state-owned Egyptian newspaper on July, 16.

It reflected the wishful thinking of the ruling regime in Egypt, which came to power after plotting a brutal coup against the first democratically elected Egyptian president three years ago.

According to some reports, the representative of the regime in the United Nations Security Council attempted to block a statement to respect the democratically elected government of Turkey. There were no surprises there.

Inside Story - What will Turkey's failed coup mean for its relations?

Egypt's putschists

Both Egypt and Turkey have suffered from many coups and serious coup attempts since the establishment of their republics.

In Egypt, a 1952 coup ended the constitutional monarchy and a 1954 one ended a fragile transitional period and established an "officer's republic" (PDF).

In 1971, a coup by Nasserist generals was foiled by President Anwar Sadat loyalists. But the last three military interventions in Egypt were quite successful.

A 2011 coup by the Supreme Council of the Armed Forces (SCAF) ended Hosni Mubarak's dictatorship and cleared the path for a transitional period following an 18-day popular uprising.

OPINION: The lessons to be learned from Turkey's failed coup

The SCAF maintained the special prerogatives of the military, including their veto in high politics, their independent, off-budget military-economic complex, and their legal immunity from civilian courts.

In 2012, a less recognised coup was received with neither local resistance nor international condemnation. The SCAF dissolved the parliament and announced a constitutional declaration to further empower its mandate.

But the 2013 coup was the bloodiest. It revoked the two main gains of the transitional period: unprecedented basic freedoms and unprecedented free and fair elections. It certainly divided the country, perhaps permanently.

Turkey's dark past

Turkey's trajectory was quite different. A 1960 coup ended Turkey's first democratic alternation of power with a resounding tragedy: the execution of Prime Minister Adnan Menderes and two others.

The junta of 1960 purged 235 generals, more than 3,000 officers, 500 judges and hundreds of university professors.

A 1971 was a "gentler" coup; by a memorandum rather than murder and purges.

Almost every component of the Turkish nation successfully resisted the 2016 coup attempt, including the military, the police, the intelligence, the political class, the media and the citizenry.

 

But perhaps the 1980 coup was the bloodiest of all successful ones: 50 executions and more than 500,000 arrests.

Like 1971, the 1997 coup was also by memorandum. Both politicians and public complied.

But the trend started collapsing as of 2007. A coup attempt in the disguise of an e-memorandum published by the military was averted by a combination of early elections and threats to raise the coup costs.

Turkey was certainly changing. And this did not register with the 2016 putschists.

Why did it fail in Turkey?

So, why were the last coups successful in Egypt and utter failures in Turkey? There are about six solid differences.

On a macro-level, Turkey is usually in the second quarter of the Human Development Index. Egypt is usually in the third or the bottom quarter (XLS). The level of social and institutional development mattered.

History also had its impact. The 1980 coup left deep scars on Turkish society. Only the 2013 coup in Egypt had a similar - but quite recent - effect.

On a meso-level, the Turkish political class showed much higher levels of maturity and vision than their Egyptian counterparts.

OPINION: Turkey-US - What's the problem?

Generally, most of electoral losers in nascent democracies would opportunistically side with the putschists - a pattern established in Egypt in 1952 and 2013, in most of South American coups of the 1970s, and elsewhere (PDF). In 2016, Turkey was an exception.

The quality of leadership also mattered. President Recep Tayyip Erdogan and Prime Minister Binali Yildirim's charisma, tenacity and clarity has been inspirational.

This is in comparison with Mohamed Morsi's tendency to call the military commanders "men made of gold" and the police as the "heart of the January Revolution", while they were plotting against the presidency with clear signs as early as March 2013.

The balance of hard power was a fifth critical factor. The Turkish military, security forces and intelligence directorate were instrumental in countering the putschists from the first hour.

"We will fight till the last bullet" was an unusual statement from the National Intelligence Organization (MIT). It did fire up national resistance sentiments, not just among the ranks of the security and military forces, but also among the general population.

The quick anti-coup strategies and tactics employed by the First Army commander, the security special forces, and the MIT were overall quite effective.

OPINION: People defeated the coup in Turkey

None of that occurred in the Egyptian case. Government loyalists and pro-democracy officers could not coordinate a counter-coup strategy, mainly owing to their limited numbers and resources.

But also, in 1954, their forefathers had both numbers and resources. They still failed to counter the coup against Egypt's first president, Muhammad Naguib.

Civil resistance

On the micro-level, the solid civil resistance by Turkish citizens was impressive in 2016 as it was in the Egyptian case of 2011 and 2013.

It was perhaps the first time in the history of civil resistance to coups when civilian cars have attempted to block fighter-jets' runways to prevent them from bombing an elected parliament.

It is also one of the rare times when civilians just duck - not run - under bullets, before they stand up and chant again, once the shooting stops.

The quick mobilisation on the streets of Istanbul and Ankara were critical, but - as shown from Argentina to Indonesia - this is never a decisive factor on its own.

Egypt had probably one of the longest and most resilient sit-ins in its modern history in Rabaa and Nahda squares.

They did end up in a bloodbath committed by the military, owing to the lack of the aforementioned factors.

Almost every component of the Turkish nation successfully resisted the 2016 coup attempt, including the military, the police, the intelligence, the political class, the media and the citizenry.

To the bitter dismay of Egypt's putschists, the coup was unsuccessful. But the lessons learned for Egypt are numerous and they will certainly affect the future of democratisation in that country.

Omar Ashour is Senior Lecturer in Security Studies at the Institute of Arab and Islamic Studies at the University of Exeter and an Associate Fellow at Chatham House.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.

Source: Al Jazeera