The Ottoman Empire, the Sick Man of Europe in the nineteenth century, finally was put out of its misery by military defeat in World War I, to be replaced by the enlightened despotism of Mustafa Kemal Ataturk, a war hero at Gallipoli, who established a provisional government in Ankara as the head of the Turkish National Movement, and successfully thwarted the Allies who had threatened to move on the Turkish heartland in Anatolia.

Ataturk systematically instituted political, economic, and cultural reforms, to create a modern, secular, nation-state in what was left to the Turks – Anatolia and the sliver of European Turkey — after the Ottoman Empire dissolved. Ataturk’s reputation as a hero of the fighting in the Dardanelles made it possible for him to impose his vision of a post-Ottoman Turkey. And because the Turkish defeat in the Great War so incontrovertibly revealed the weakness of the Ottoman state, the reforms that he pushed to modernize and secularize the Turkish state, even though revolutionary in the Muslim context, were also hard to oppose. His first important secular act was the dissolution of the Caliphate in March 1924. This was a tremendous blow to Islam, but non-Turkish Muslims were in no position to force a secularizing Turkish leader to maintain the Caliphate, and in any case, the Arabs in the Middle East – remember Lawrence of Arabia? – had, thanks to the help of the British, just removed their Turkish overlords in Arabia, Syria, and Iraq, and certainly would not miss Turkish rule. Ataturk and his associates wanted to make sure that, as a contemporary account put it, “the Turkish nation would be absolute master in its own house, and […] it should retain neither pretensions nor liabilities outside what it regards as the proper boundaries of its own ‘national home.’”

Ataturk lost no time in constructing the new, republican and secular Turkish polity that would replace the collapsing Ottoman regime. This new polity depended for its legitimacy on how well it reflected the will of the people, expressed through the ballot box, rather than, as orthodox Islam demanded, the will of Allah as expressed in the Qur’an. Turks were no longer subjects of a Sultan, but citizens of a republic. Offices were no longer hereditary, but won through elections. The Sharia was abandoned as the source of all law. The Sharia law codes were replaced, by adapting European laws and jurisprudence to meet the needs of the new republic. Civil laws were now based on the civil code of Switzerland, the Turkish penal code now modeled on that of Italy, and business laws based on the German model.

A major part of Ataturk’s program was to give women full civil and political rights, in direct defiance of the subordinate role they had under the Sharia. He managed to do this by degrees, first giving them the right to vote in local elections in 1930, and then in 1934, giving them the right to vote in all elections. Universal suffrage was thus instituted in Kemalist Turkey even before it came to some states in Western Europe, such as Switzerland. The rules of inheritance were changed from that mandated in the Sharia, so that women could now inherit equally with men. The wearing of the hijab was discouraged, though not forbidden outright. Polygamy was banned. Coeducation was introduced in all the state schools, and girls were subject to the same rules for compulsory education as boys.

Above all, Ataturk made secular education a priority. Thousands of schools were built, primary education made free and compulsory, open to both girls and boys, and the contents of the curriculum made determinedly secular. Existing universities were expanded; new ones were built. These tended to be, and have remained right up to the present day, centers of Turkish secularism. Madrassas lost much of their former importance, as the expansion of the network of free state schools and academic high schools offered a more attractive alternative.

Everywhere he could, Ataturk tried to limit the power of Islam. He ordered the dissolution of the Sufi orders. He had religious headgear and regalia banned outright, including the fez, the turban, and the veil (see the Hat Act of 1925), all connected to the earlier Ottoman order. He could not have dared to suppress religion outright, but he wanted to apply the French principle of laicite as his model of modernity: mosque and state would be kept as separate as possible. Non-Muslims were given the same civil and political rights as Muslims. But in order to make sure that this separation of mosque and state stuck, Ataturk paradoxically had to inject the state into religious affairs by monitoring the mosques. He especially wanted to make sure that the khutbahs, often highly charged political sermons given during Friday Prayers, were vetted in advance by the secular authorities. He had the Qur’an, together with a tafsir or commentary, translated into Turkish. This had two consequences: first, it undercut the “Arab supremacism” inherent in Islam (non-Arabs had been taught that the only valid version of the Qur’an was that in Arabic) and second, the Turkish version of the Qur’an, and the tafsir that supplied an interpretive gloss on the text, resulted in a version not quite as violent as the Arabic original.

Instead of ignoring or dismissing, as Muslims are taught to do, the pre-Islamic period of Turkish history as of little or no interest, being from the Time of Ignorance, or Jahiliyya, Ataturk encouraged the collection and study of pre-Islamic artifacts in Anatolia, as part of creating a national narrative that included the pre-Islamic peoples. This, too, constituted part of Ataturk’s breaking with Islamic tradition. And in a kind of replacement theology, the cult of “the Turk” replaced that of Muslims as “the best of peoples,” and the cult of Ataturk replaced that of Muhammad.

Ataturk was himself a military man, and the Turkish army became the protector of Kemalism whenever it appeared to be threatened. Despite the conservative (i.e., Islamic) nature of much of the Turkish population, any government that moved away from Kemalism would face the threat of a coup by the generals. And they meant business: after one coup in 1950, a prime minister was hanged. And right up to the time of Erdogan, the triumph of Kemalism seemed complete – not only to the Turkish secularists who now ran the universities and peopled the media, but to the Western governments that regarded Turkey as a staunch member of NATO, and whose generals would meet like-minded Turkish generals, often at the Defense Ministry in Ankara, just as Western journalists and academics would meet their Turkish counterparts, also deep believers in the changes wrought by Ataturk and his epigones. It seemed obvious that Kemalism was there to stay. These Western generals, journalists, academics, did not meet with, were scarcely aware of, that other Turkey, of farmers in the countryside, and the rural poor who had migrated to cities, and even a conservative Islamist middle class, the “silent majority” who were devout Muslims unreconciled to Kemalism, but still lacked a champion who could maneuver around the generals.

That champion was Erdogan. In 1997, he famously declared – and was jailed for ten months for doing so – that “the mosques are our barracks, and the minaret is our bayonet.” That prison sentence turned Erdogan into a martyr, and six years later, with his AKP Islamist party victorious, he was appointed Prime Minister. In 2003, the generals still held a great deal of power. But Erdogan, a devout Muslim, had clear ambitions to unravel Kemalism, slowly but systematically. He cleverly exploited Turkey’s candidacy to join the E.U., which required limiting the power of the Turkish military, doing so ostensibly to meet the requirements of the E.U., but in fact to make it harder for the military to oppose his anti-Kemalist campaign. Historians will shake their heads at the heedlessness of the European powers, who treated these limits on the Turkish military as a welcome “move toward greater democracy,” failing to understand that in the Turkish context, the military defenders of Kemalism were the only ones who could prevent a backslide into Islam. He moved slowly, at first, mainly by filling the state institutions with his own men, removing many from the officer corps, firing or intimidating journalists, treating all those who opposed him and his party as enemies of the state who might be fined, or summarily discharged, or even jailed.

Erdogan has managed – slowly, stealthily — to have 17,000 new mosques built by the government since he first came to power. What particularly has alarmed secularists is the giant mosque the government is now building, more than 150,000 square feet in size, high on a hill on the Asian side of the Bosphorus. Muslims have always believed that an imposing physical presence for mosques helps to impose their message as well, and as is well known, under Muslim rule Christians and Jews were forbidden to build their houses of worship higher than any nearby mosques. He has accelerated, since the attempted coup last month, his determination to root out all secularists from the army, the media, and the educational establishment. A decade ago, Turkish generals would not promote to the upper ranks of the military those who were judged to be “too devout.” Now those generals have been cashiered, and some are to be tried as traitors, while officers who support Erdogan have been put in their place. been reversed.

In 2013 Erdogan ended the ban on the wearing of the hijab in the civil service jobs and government offices, including universities. He has publicly insisted that women are “to be treated differently from men” because of their physical weakness. Several of his closest advisors have two wives; one of them – Ali Yuksal — has four. Apparently the official ban on polygamy – admittedly never fully enforced in the countryside – is being flouted at the highest levels of government.

Above all, Erdogan has reintroduced much more religious content to Turkish schools. His government was aiming, he said in February 2012, at “raising pious generations.” Beginning that month, his government embarked on a wholesale reform designed to Islamize Turkey’s education system. In the regular state schools, the amount of time now given to religious instruction has steadily increased. But even more important than that has been the way that the enrollment in the imam-hatip schools, which were originally intended to prepare imams and preachers for Turkey’s mosques, has steadily grown. These imam-hatip schools provide 13 hours of Islamic instruction each week along with the regular curriculum. Here is how, according to Svante E. Cornell, Erdogan managed to triple the enrollment of the imam-hatip, or religious, schools:

The reforms [by Erdogan] turned “religious schools from a selective option to a central institution in the education system.” This is the case because the reforms introduced entrance examinations for all high schools except the imam-hatip schools. Thus, all students who do not qualify for other schools would have no choice but to enroll in religious schools. In August 2013, over 1,112,000 students took the placement test for 363,000 slots in regular, academic high schools. Those that did not make the cut had to choose between secular vocational schools, imam-hatip schools, and a variety called “multi-program high schools”. But the latter are only available in remote areas, and do not even exist in the entire province of Istanbul. In other words, parents and students were forced to choose between vocational schools and religious schools. As a result, 40,000 students were automatically enrolled in imam-hatip schools against their will, including numerous Alevi and Armenian students, neither of whom are Sunni Muslims When the AKP was first elected in 2002, 65,000 students studied in imam-hatip schools. That number grew to 658,000 in 2013. In May 2015, Bilal Erdoğan, the President’s son, who is (informally) in charge of the Türgev foundation that is spearheading the expansion of imam-hatip schools, announced that the number of students had reached one million.

Erdogan thus managed, by cleverly manipulating the requirements for each category of school, to expand the number of imam-hatip graduates from 65,000 to one million. It’s an astonishing feat, and for those who remain loyal to Kemalism, deeply frightening.

The coup that was just crushed, with Erdogan supporters coming out on the street, and the subsequent roundup of tens of thousands of coup-supporters, suggest that the power of Erdogan and his party, to continue their evisceration of the military, the educational establishment (especially university faculties), and the media, cannot be stopped. Almost every other day thousands of new arrests and new discharges (especially from the army’s officer corps) are announced. And the re-Islamisation continues as well.

What did the failure of the coup signify?

Some have suggested that the coup’s failure was solely the result of the coup plotters being unused to the age of social media. In the past, an old fashioned coup only required army tanks to take over the television stations and a few government offices, and then broadcast to an easily-intimidated population news of their seizure of power. Now the proliferation of social media makes that impossible, for one can go to Facebook or Twitter to discover a competing narrative, or be called on to go out into the streets to support the supposedly overthrown regime – which is exactly what happened.

But it was not only a failure of tactics, but of understanding how far Erdogan and the AKP have moved Turkey, with the support of many Turks, away from Kemalism and away from its former alliance with the West. An early sign of this was when the Turkish Parliament refused the American military permission to deploy the 4th infantry into northern Iraq in 2003, which shocked American officials who had been used to dealing with a loyal member of NATO. Disturbing to American officials, too, has been the extraordinary popularity in Turkey of the two movies Valley of the Wolves: Iraq and Valley of the Wolves: Palestine, the first full of anti-American and anti-Semitic conspiracy theorizing, the second a similar hate-filled tale of brave Turks taking revenge on a villainous Israeli general who supposedly ordered the attack on the Mavi Marmara. Israel, once a partner of Turkey, has under Erdogan become the object of sustained vilification: in July 2014, Erdogan appeared before the lawmakers in Parliament wearing a Palestinian scarf and accusing Israel of having “surpassed Hitler in barbarism.”

Many more, and much bigger mosques, more than a million students in the imam-hatip schools, hijabs and veils back in vogue, polygamy practiced among the President’s cronies, conspiracy-theorizing movies about the Americans and Israelis, demonstrations by pro-Erdogan civilians at the Incirlik air base and 7,000 Turkish military police who have surrounded that American base and briefly blocked all access – all this suggests that Turkey is returning to its inner essential Islam, and that there is nothing the West can do about it. Just as the “real” Iran turned out to be not that of the secularizing Shah, but that of Khomeini and his successors, the “real” Turkey turns out to be not that, as many so mistakenly assumed for so long, of Ataturk and Kemalism, but rather that of Erdogan, and orthodox Islam.

Like the Kemalists, Erdogan has used the domestic intelligence agency MIT to eliminate his critics, giving it nearly unlimited powers, so that it can wiretap telephone conversations and access the data of government agencies and companies without court order. Erdogan’s political opponents are treated as enemies of the state. Journalists who are critical of him or his government have been arrested or fired. Every day brings more news of the firing or transferal to other posts of judges, prosecutors, and police officers. Social media is repeatedly blocked. The latest coup attempt has given Erdogan the excuse he needed to engage in a full-scale purge of the Turkish military which, some have pointed out, will weaken the army at a time of great turmoil all around Turkey’s neighborhood.

“The mosques are our barracks, and the minaret is our bayonet.” That sentence earned Erdogan a prison sentence in 2003. Now he is sentencing to prison those who disagree with that Islamic sentiment. Every day brings fresh news of Erdogan’s massive crackdown on those who remain loyal to the ideals of Ataturk. So far, since the failed coup, Turkey has suspended or removed more than 60,000 people from jobs in the military, security services, judiciary and media, with additional tens of thousands of teachers being dismissed. For the first time in 80 years, the muezzin’s call to prayer can be heard from within the Hagia Sophia. Kemalism, the most successful effort to modernize a Muslim state through taming the power of Islam, has turned out to be temporary, while Islam, thanks to the ruthless cunning of Erdogan and the bland complacencies of the West, appears — at this dismal point in Turkey’s modern history — to be forever.