The revolution always eats its children: in France, in the Soviet Union, in China, and, now, in Turkey.

Prime Minister Recep Tayyip Erdoğan, one of the most remarkable figures in the modern Middle East, is fast discovering that the authoritarian measures he has increasingly relied on to govern Turkey, and the cult of personality he has built around himself, are conspiring to bring about his political demise. Early this week, three members of Erdoğan’s cabinet, their sons implicated in a far-reaching corruption investigation, resigned, and one of them called on Erdoğan himself to quit. Yesterday, Erdoğan, in a blatant attempt to thwart the investigation, dismissed the lead prosecutor after he announced that he was investigating Erdoğan’s son. The drama is just beginning.

In nearly eleven years in power, Erdoğan, as the head of the Justice and Development Party, has transformed the Turkish state and society, and helped send the economy on a decade-long run of rapid growth. With a mix of populist bluster and political savvy, Erdoğan gave voice to the long-suppressed yearnings of Turkey’s pious majority and, at least in the beginning, seemed to give proof to the idea that Islam and democracy could thrive together. Through all of that, Erdoğan broke the power of the Turkish military, a reactionary institution that has stifled Turkey’s democratic yearnings since its founding.

But in recent years, intoxicated by his own ascent, Erdoğan began to act like a leader who believed that Turkey’s success and his own could not be separated. And the very mechanisms that enabled his rise began to turn on him.

From the beginning, Erdoğan’s success was made possible by, among other things, an alliance with the followers of Fethullah Gülen, the leader of a far-flung Islamic order whose members pride themselves not just on their piety but also on their business acumen. As I wrote last year in the magazine, the Gülenists, as they’re known, come across in person as amalgams of Dale Carnegie and a Christian missionary: smiling, clean cut, and relentlessly cheerful. Gülen himself lives in Saylorsburg, Pennsylvania, having fled Turkey in 1999, when it appeared as though the Turkish military was preparing to arrest him on charges of conspiring to overthrow the country’s secular order. (Gülen was acquitted in 2008, but he has not returned.)

For much of Turkey’s history, civilian governments, together with the military, enforced a rigid and often mindless secularism, where even the most nominal displays of piety were suppressed. For this reason, the Gülenists, as members of an Islamic order, operated in secret, rarely advertising their affiliation, even though their brand of Islam is ostensibly moderate.

When Erdoğan came to power, in 2003, the Gülenists, whether by agreement or by design, began to infiltrate Turkey’s police departments and judiciary. This enabled Erdoğan to begin an epic crackdown on the military and on what Turks call “the deep state,” a shadowy network of élites that, since Turkey’s founding in 1923, has helped enforce the secular order. The crackdown, beginning in 2007, targeted something called “Ergenekon,” which prosecutors and police claimed was the name given to the deep state itself. Over the past six years, hundreds of Turks have been arrested and jailed, not just military officers but university leaders, newspapers editors, owners of television stations, and opposition politicians, as well.

There isn’t much doubt that something called “the deep state” actually existed in Turkey, and that it used violence and intimidation to enforce the secular state enshrined by Turkey’s founder, Mustafa Kemal, or Atatürk. But the Ergenekon investigation, along with its sister case, called Sledgehammer, rapidly evolved into something much more pernicious: a campaign to crush Erdoğan’s political opposition. The Ergenekon and Sledgehammer prosecutions were built on mostly fabricated evidence.

In case that didn’t work, Erdoğan embarked on an aggressive campaign to silence anyone who might criticize him, most notably the press. Just last week, the Committee to Protect Journalists reported that Turkey had forty reporters behind bars, more than any other country in the world.

All this worked for a while, in no small part because Erdoğan faced almost no criticism from the West. The Obama Administration, grateful for an ally in an otherwise unfriendly part of the world, largely gave the Prime Minister a pass. Erdoğan, who is planning to run for President in 2014, seemed destined to stay in power for years to come.

But then it all unravelled. It’s not clear why Erdoğan and Gülen are splitting now, but, according to some reports, the roots may lie in disagreements over foreign policy and how to deal with the country's Kurdish minority. Among other things, the Gülenists oppose Erdoğan’s arming of rebels in Syria and the cooling of the Turkish government’s long-standing friendship with Israel. The Erdoğan-Gülen break also follows Erdoğan’s brutal suppression of anti-government protests that swept the country ealier this year. Those began when the police forcibly evicted a group of peaceful demonstrators in Gezi Park in Istanbul, where they had gathered to protest Erdoğan’s drift toward authoritarianism. The resulting crackdown injured some eight thousand people and killed five. For Erdoğan and Turkey, if not for Gülen, Gezi Park was a turning point.

What happens now? The AK Party, as it is known, has been in power for eleven years, and the smell of corruption is everywhere. Erdoğan has denied any wrongdoing, and said this week that anyone who tried to implicate him would be left “empty-handed.” But if prosecutors are inclined to follow their leads, and if the imam in Pennsylvania is behind them, there is no telling how far they will go, or when stability will finally return to Turkey.

Photograph: Umit Bektas/Reuters