Turkish President Recep Tayyip Erdoğan is all but certain to become the longest serving Turkish leader in modern history, surpassing even Mustafa Kemal Atatürk. The founder of modern Turkey ruled the country for 15 years between 1923 and 1938. By the time he finishes his current term, Erdoğan will have run Turkey for 17 years, as prime minister between 2002 and 2014 and as president until 2019.

Erdoğan is often cast as an Ottoman revivalist. His critics suggest he wants to do away with the legacy and policies of Atatürk, who established Turkey as a modern secular republic in the 1920s, and bring back the Ottoman Empire in its place. But Erdoğan’s agenda goes deeper: He wants to rid Turkey not only of the legacy of Atatürk, but also of the late, westernized Ottoman Empire.

Often portrayed as a standalone revolutionary leader, Atatürk is really a product of the Ottoman Empire. He was educated in Ottoman schools and served in the Ottoman military.

The Ottoman pivot to the West that produced Atatürk and other like-minded Westernizers followed a period of painful soul-searching. The Ottomans, the dominant power in Europe in the 16th century, stalled in the face of the emerging strength of the Christian powers in the early 17th century, who first blocked the Ottoman advance into Europe and then dealt them a crushing defeat at the gates of Vienna in 1683.

The Ottomans’ initial response to their sudden loss of superiority over Christian Europeans was denial, embodied by religious fundamentalism, and in the mid-17th century, a religious tide, the little known Kadizadeli movement, swept across the Empire. The movement, led by the Muslim judge Kadızade Mehmed, was strengthened by its young and committed seminary students known as the Taliban (the word simply means “students” in Arabic and Ottoman Turkish).

In a textbook case of religious fundamentalism, the Kadizadeli Taliban movement asserted that the Empire’s inability to maintain the dominance of “true Islam” over its policies had led to its decline. Kadizadeli-Talibans claimed that, by eliminating its tolerance and open-mindedness, the Ottomans could “rid Islam of accretions”— the ageless recipe for “reform” among countless Islamist movements since, including the Wahhabis and jihadists — and the Empire could be restored to its former glory.

* * *

So the Ottomans tried fundamentalism. They imposed onerous burdens on Jews and Christians, temporarily dispensing with the religious openness of their social organization. They banned alcohol and tobacco, and persecuted non-orthodox Muslims, such as the Sufis. However, these religious policies — the timeless toolbox of Islamists — failed to restore Ottoman strength. Western powers and Russia crushed the Ottomans even more severely in wars in the 18th century than they did before the rise of the Kadizadeli movement. The Ottomans slowly and painfully realized that religion does not ensure political greatness.

The AKP elites claimed that Kemalism’s strict separation of religion and state was unnatural and deemed public displays of piety, such as government employees donning the headscarf, completely acceptable.

This string of humiliating losses prompted a process of introspection in the 18th century. The Ottoman sultans decided to westernize their state in an effort to catch up with the rising powers of Europe. In the late 18th century, Sultan Selim III, a contemporary of Napoleon, initiated these efforts by westernizing the Ottoman military, and his successors in the 19th century continued to restructure the Empire’s bureaucracy and educational system, giving way to progressive concepts such as women’s education, joining the European concert of nations, and secular courts. Religious matters increasingly fell under the control of the state.

These reforms shaped the environment that produced the father of modern European Turkey in 1923, Kemal Atatürk, an Ottoman military officer from a modest family background, trained in the Empire’s schools under a secular Western curriculum.

When the Empire collapsed at the end of World War I, the Allies occupied the Ottoman Empire. Atatürk first led a successful campaign between 1920 and 1922 to liberate Turkey, then pushed for deep reforms to fully secularize the country. He abolished what remained of the Sharia in the Ottoman court system, instituted a completely secular public education system, and declared full equality between women and men. In a break from the Ottoman approach, he banished religion to the private domain. In foreign policy, Atatürk embraced the notion of Turkey’s European nature even more openly than the Ottomans, pivoting the country away from the Middle East.

That lasted until very recently. After coming to power in 2002, Erdoğan sought to roll back the Kemalist legacy. The AKP elites claimed that Kemalism’s strict separation of religion and state was unnatural and deemed public displays of piety, such as government employees donning the headscarf, completely acceptable. In the foreign policy sphere, they focused on re-engaging the Middle East and cementing Turkey’s status as a regional Sunni power.

But Erdoğan did not stop there. He appears intent on uprooting the Ottoman legacy of Westernization and reinstating Islam to a central role in politics, almost harkening back to the wayward Kadizadeli movement. Alluding to 19th-century Ottoman reforms, Erdoğan recently said, “For 200 years, they tried to tear us away from our history and from our ancestors. They tried to get us to disown our claim.”

* * *

Erdoğan’s recent policies suggest that this is not mere rhetoric. In December 2014, Turkey’s Higher Education Council, a government regulated body, issued a policy recommendation suggesting that mandatory courses on Islam be taught to all students as young as six in public schools.

Freedoms of expression and media are unfortunately in free-fall in Erdoğan’s Turkey.

The foundations of secular education in Turkey are in grave danger. The number of Imam Hatip Schools — publicly funded schools that follow a religious curriculum — has more than doubled, from 493 in 2010 to 1017 in 2015. As of 2014, students who fail to gain entrance to the country’s small number of prestigious high schools are automatically enrolled in Imam Hatip Schools. Increasingly, good quality secular education is becoming off limits to average Turkish students. Atatürk could not have been raised in today’s Turkish school system.

Erdoğan has also taken worrying positions on gender equality. In November 2014, he claimed, “You cannot make women equal to men. It is against creation…it is against nature." There is little room for women in politics in Erdoğan’s Turkey. This stands in stark contrast to Atatürk’s Turkey, where 36 percent of academics and 28 percent of judges and prosecutors were women, according to a 2000 report by TUSIAD, a Turkish business think tank based in Istanbul, and government statistics.

And although Turkey still has a secular constitution, the government has made a habit of subjugating freedom of expression to religion. Fazil Say, a renowned Turkish pianist, was sentenced to 10 months in prison in 2013 for “defaming Islam.” His crime was retweeting lines lampooning religious orthodoxy.

What will become of Atatürk’s Turkey under Erdoğan?

Freedoms of expression and media are unfortunately in free-fall in Erdoğan’s Turkey. In 2002 when the AKP came to power, Turkey ranked 99th in press freedom among the 139 countries surveyed by Reporters without Borders. In 2015, the country ranked 149th out of 180 nations surveyed by the same organization.

Finally, Erdoğan has made religion the focus of Turkish foreign policy. This is manifest in its relationship with an array of Islamist groups including Hamas, conservative Syrian rebel factions, and the Muslim Brotherhood in Egypt and Libya. As a result, Turkey faces newfound threats from Islamist extremism as demonstrated by recent Islamic State (IS) attacks in the country, including a January 12th IS suicide bomber that targeted Istanbul’s old city, the home of the Ottoman sultans. In making Islam the guiding principle of Turkish politics, Erdoğan could soon find himself in competition with radical and violent elements about the definition of “true Islam.”

What will become of Atatürk’s Turkey under Erdoğan?

The closest, though imperfect, analogy is Mao Zedong’s legacy in China. Everything in today’s diehard capitalist Chinese society screams “I hate Mao!” Yet the former leader’s pictures are still plastered all over the country. In essence, the country’s leaders exploit his image as the country’s liberator and a source of legitimacy, but strip the country of his core legacy.

Erdoğan is seeking something similar. His Turkey is as far as it can get from being secular in politics and education, European-minded in foreign policy, and respectful of gender equality in domestic issues. The late Ottoman sultans and Atatürk alike would be shocked if they could visit Erdoğan’s Turkey.

While Erdoğan will continue to chip away at the legacy of Atatürk — still a revered figure of liberation — and the westernizing Ottoman sultans, their statues will continue to adorn town squares, providing the current government a façade of legitimacy.

Soner Cagaptay, Beyer Family fellow and director of the Turkish Research Program at the Washington Institute, is the author of "Rise of Turkey: the 21st Century’s First Muslim Power" (Potomac Books, 2014).