Turkey is in an unprecedented state of political tumult. Since the ascent of Recep Tayyip Erdogan’s Justice and Development Party (AKP) to power in 2002, all Turks have struggled to support, defeat, or accommodate this party that rose suddenly in free elections to national power. Now, that contest has entered a new and more dangerous phase.

Looking back, the AKP’s opponents cannot claim to have been perfect during their times in power, either. The steps to muzzle Turkey’s democratic processes prior to 2002 came from people within an interlinked matrix of the military, security, and judicial sectors, as well as some compliant political leaders and the media—the so-called deep state. Many felt that these were Turkey’s real rulers—out of sight and unaccountable. On four occasions, this group—led by the military—overthrew democratically elected Turkish governments. There were instances of collaboration with criminal elements and non-judicial killings. Ruling parties were forced to accommodate the powers behind the curtain or leave office.

This leadership may have saved the country from chaos, but it did so at the expense of the democratic process. Its no-tolerance approach to religion in politics gradually increased resistance among Turks wishing to be both Muslim and democratic.

This unhealthy development of the Turkish state may not have been what Mustafa Kemal Ataturk, the revolutionary founder of modern Turkey, would have sought himself. To his credit, Ataturk always made clear his long-term trust in democracy. With this inspiration, Turks early on had embraced the principles of democracy and worked to make them a reality, despite coups and setbacks.

As time went by, however, the traditional parties claiming the Ataturk mantle were clearly unable to solve basic economic, legal, and social issues. No traditional party, for example, ever solved the rampant inflation that year after year gnawed away at the Turkish working class. One traditional party after another took office, failed, and was replaced in a merry-go-round of disappointment. 

A great deal of pent-up hope and frustration thus swept the AKP into power 12 years ago. The economy had collapsed, and the previous government was hapless. Even the brilliant efforts of Turkey’s economics minister, Kemal Dervis, to press for deep and wide reform were partially undermined by his own government leaders and fellow ministers.  

The AKP promised clean government and a new start for a broader democracy. In doing so, it drew on the reservoir of unhappiness with the deep state. Its winning coalition ran from modern urban secular and young left to conservative rural and religious right. The immediate effect of the AKP’s economic reforms was a surge of widely shared prosperity.

For five years, it looked as if this new national coalition would realize its professed goal to broaden domestic democracy, to join the European Union, and to become a shining example of successful development for other Muslim states. While the AKP never received an absolute majority from Turkey’s voters, the losing parties proved incapable of creating a viable alternative. The economy continued to boom, and there was justified pride in Turkey’s demonstration of its people’s talents and acumen.

Then the wheels began to come off the train. As the party rode from one election success to another, the corrosive effect of apparent invulnerability began to affect the leadership. Lacking any serious public objection within the party or an effective opposition, the government began to move away from being a government of the people to becoming a government over the people. The government’s vision for the people became more important than the people’s vision for themselves.

Press freedom was suppressed, corruption was left to flourish, the army was crushed instead of being reconciled, the judiciary was marginalized, the police forces were purged, anti-Semitism was legitimized, and the laws of economics were increasingly ignored. Now ordinary Turks are called traitors if they oppose the newest legislation on security. Those who buried the deep state are exhuming it.

One fundamental reason democracy works in the long run is because it attenuates the excesses of power, which almost inevitably overreach. There is no control beyond self-control on a leader who thinks more and more power and more and more control will make the vision he has safer and safer. 

President Erdogan showed himself in earlier days to be an astute, intelligent, and highly effective political leader. He has heard the advice that building a broad consensus to support Turkey’s democratic future is far superior to imposing a future on citizens stripped of legal protection. The best thing about going in the wrong direction is knowing that one can always turn around and go the right way. Even powerful voices in the AKP are calling for a second look at the government’s draconian measures. For Mr. Erdogan, this is precisely the moment to credit the voices of wisdom and return the deep state to its grave.