Turkey has had its fair share of military coup d’états. The government has been overthrown three times – in 1960, 1971 and 1980 – and several more putsches have been narrowly avoided by the military dropping “hints” that it would step in if things didn’t change.

It was still surprising to see soldiers and tanks blocking the bridges across the Bosphorus in Istanbul on July 15. The coup was destined to fail and those accused of involvement – who apparently number several thousand people – face stiff punishment, and potentially even the death penalty.

But perhaps more surprising was the sight of thousands of Turkish people taking to the streets to take on the plotters. Soldiers were beaten and rounded up by citizens angered by what they saw unfolding around them.

They had answered when President Recep Tayyip Erdogan called on them to fight for him. Turkey is a very illiberal place where dissent is not tolerated so it was surprising to see so many people flock to the defence of their widely-criticised leader.

Authoritarian state

For almost 10 years, Turkey has been drifting towards authoritarianism. Life has become distinctly uncomfortable for anyone who doesn’t support Erdogan and his party, the AKP. The government controls the news media, has undermined the rule of law and clamped down harshly on any kind of peaceful protest. So while Turkey is still democratic – in that Erdogan is elected – it is not a liberal country.

The military, as a long-time stalwart of secular Kemalism, has borne the brunt of AKP illiberality. Coups are of course, not liberal mechanisms for winning power, but in Turkey, they have always been aimed at preventing a drift away from the democratic path envisioned by Ataturk, the hero-worshipped founder of the republic.

The military’s wings have been clipped by a series of bogus investigations instigated by the state since 2007. Under the guise of looking into supposed anti-government plots, the AKP was able to remove hundreds of senior officers – mostly staunch Kemalists – from the military.

Each time, they would be replaced with government sympathisers. Academics, journalists, lawyers and others have all been caught up in these investigations, adding to the general air of intolerance and illiberality in Turkish society. Just under half of the population are not AKP supporters, and many of these people feel alienated.

Erdogan was able to crush the coup incredibly quickly because he is a master of populist rabble rousing. Just under half the country oppose him and feel alienated by the general direction being taken, but the 50% or more who are loyal to him are very loyal indeed. He has raised living standards and given back self-esteem to the pious, socially conservative section of society undoubtedly neglected by the previously dominant Kemalist secular elite.

The president was able to move his supporters onto the streets with ease because they have waited 50 years for a share of the power in Turkish politics and they are not going to let go of it without a fight. Those on the streets are the most enthusiastic but even Erdogan’s opponents do not want a return to military rule. The coup plotters were unable to win popular support because while Erdoğan is a loathed authoritarian figure, Turks do not want to return to military authoritarianism either. Its reputation precedes it and Turks have long memories. “The worst democracy is better than no democracy” has been a familiar refrain on social media.

It remains unclear who was responsible for the attempted coup, even as the supposed ringleaders are being arrested. It could have been a Kemalist rump within the military or a cluster of officers supporting dissident Fetullah Gulen. Many Turks believe it was a false flag operation designed to create the conditions in which Erdoğan could launch a clampdown on his remaining opponents. That scenario might seem outlandish, but it’s eerily familiar to anyone who has followed the investigations against supposed dissidents over the past decade.

Ultimately, Erdoğan is the winner of this ruthless political dogfight which has cost 300 people their lives and many thousands more their liberty. He has taken the opportunity to push his Putinesque power grab a stage further. Freedoms of expression and association now only exist if you support the AKP. The rule of law and press freedom are long gone and illiberality in Turkey just got even worse.

Natalie Martin, Lecturer in Politics and International Relations, Nottingham Trent University.

This article first appeared on The Conversation.