Is secular Turkey dying? To approach answering this question, compare the protests that have been raging over the last fortnight in Istanbul with the demonstrations that took place in the Turkish capital, Ankara, six years ago. In 2007, when Abdullah Gul was nominated for the presidency of Turkey, hundreds of thousands of Turks marched in protest. Gul is a devout Muslim, and his wife, Hayrunisa, wears the hijab. Turkey’s secularists, feeling endangered, demanded the withdrawal of Gul’s candidacy. “Turkey is secular and will remain secular,” they chanted, brandishing posters of Kemal Ataturk.

Six years later, Abdullah Gul is the president. His Justice and Development Party is the most popular political party in Turkey. And its leader, Recep Tayyip Erdogan, is not merely the prime minister: Denounced in 1997 as an Islamist and banned from participating in politics, he can now claim to be the most powerful leader in modern Turkey’s history since Ismet Inonu, Ataturk's successor.

It is tempting to see in the Istanbul protests a reassertion of the secular values that the West is comfortable with; some have already succumbed to this temptation, and have begun heralding the decline of Erdogan and his brand of religious politics. In reality, these protests are the desperate last spasms of a dying order.

“Islam”, Ataturk had declared soon after abolishing the Caliphate in 1924, “is a dead thing”. Eager to revamp Turkey, he compelled the people to break with their past. He expelled the Sultan, abolished the fez, imposed secularism, and implemented legal codes imported from Switzerland, Italy and Germany. Dissent, wherever it was detected, was crushed before it could congeal into a threat to the new regime. But after Ataturk’s death, what came be known as “Kemalism” was reduced by his successors to a catchcry – something that was invoked to sanctify the suffocating dominance of a tiny minority.

Aware perhaps of their own unrepresentative hold on power, they disdained and feared the majority: Anyone who was a believer. Turkey’s generals mounted a series of coups to rid the country of leaders who colluded with – or failed adequately to combat – Islamists. In the 1970s, nearly a dozen prime ministers walked in and out of office. But the transcendent irony of the army’s violent effort to secularize Turkey was that it emboldened, across the country, the resentful rabbles who were being persecuted for turning to Islam for comfort, certitude, and political guidance.

In 1997, the army, detached as ever from the world beyond the barracks, staged another coup, forcing the Islamist government of Necmettin Erbakan to, among other things, ban women who wore headscarves from public universities. It was a fatal misjudgement of the public mood. Religion was by then a powerful force in Turkish politics, impossible to ignore or subdue.

Erdogan rose to power from the debris of that coup. A protégé of the deposed Erbakan, he remembers vividly the degradations suffered by the faithful in Kemalist Turkey. But, unlike his mentor, he appeared willing to temper his ambitions at home in order to make Turkey fit for membership to the European Union. It was under the leadership of his party, between 2002-2003, that Turkey enacted its most substantial reforms. Had Europe relented and permitted Ankara to join, then perhaps a more pluralistic Turkey might have emerged. But Europe recoiled – and Erdogan turned his sights homeward. Buoyed by rapid economic growth, he fortified his base and dispensed patronage; prosecuted the generals involved in the 1997 coup and threw journalists hostile to his rule in prisons; and began initiating, incrementally, enduring pro-Islamist social change.

His “zero problems with our neighbours” policy crumbled under the weight of his ambition to make Turkey pre-eminent in the Muslim world. This required him to adopt the grievances of the region, and he obliged by loudly condemning Israel.

But it’s his interference in Syria, short-sightedly accommodated by the West and Israel, that has most severely damaged the stability of the region. By all accounts Bashar Assad, the Syrian president, accorded tremendous respect to Erdogan; by some accounts, he even treated Erdogan like a surrogate father. Yet he was baffled by Erdogan’s demand – first made in 2009 – that Damascus decriminalize the Syrian chapter of the Muslim Brotherhood. To suggest – as Western commentators repeatedly have – that Erdogan repudiated Assad because the latter opened fire on Syrian demonstrators is to be exceedingly charitable to Erdogan. As we have witnessed over the last week, when his authority is challenged, Erdogan can easily assume the deportment of a dictator.

Assad is a secularist defeated by his despotic inheritance. Erdogan is an Islamist constrained, for now, by Turkey’s defective secular democracy. But the complexion of Turkey’s neighborhood is quickly changing. Once hailed as a model for “Muslim democracy”, the idea of a “secular Turkey” is already beginning to seem odd in a region that the Turkish leadership is labouring so hard to deliver to Islamists.

Those who are prepared to make peace with this new Middle East and are abetting its formation will soon discover that faith in this region is not merely one aspect of national identity; it cannot be subordinated like that. Its claim on the individual, on society, tends towards the absolute.

Ataturk grasped that. But protected by the army and cosseted in uncontested privilege, his successors never developed an imagination for inclusive politics. Ataturk toured the villages to educate the masses; his secularizing heirs sneered at the villagers. They are responsible for their own downfall.

Years from now, we might look back on the protests in Istanbul as the swansong of a paranoid and parasitic elite whose survival at the very top depended all along on brute force and mass disenfranchisement. The tragedy is that their reign will still look better in comparison to what came after them.

Kapil Komireddi, an Indian journalist, has reported from South Asia, Eastern Europe and the Middle East.