Garvan Walshe was National and International Security Policy Adviser to the Conservative Party until 2008

We look back at moments, like the failed coup of 1981 in Spain, or De Gaulle facing down the Committee of Public Safety declared in Algiers in 1958, when democracies establish themselves, and consider them inevitable. Less exhilarating than revolutions, they mark an electorate’s political maturity. Sunday’s election in Turkey looks like such a moment.

Democratic government quite obviously involves more than elections, even free and fair elections. It takes root when the premier understands – or is forced by his people to understand – that his job is to secure the constitution even at the expense of his own future, not secure his future at the expense of the constitution.

Recep Tayyip Erdogan had been planning a constitutional coup. He wanted to impose upon Turkey a strong executive presidency, in a country that, unlike France, lacks the institutions to check its power. But his putsch was defeated, not by an army counter-coup but by the infintely more legitimate votes of the people.

Erdogan is not of course entirely without power. His AK is by some distance Turkey’s largest party. As delicious as it would be to imagine him being forced to appoint a coalition government of his opponents, the smart money is on the AK attempting a minority administration, or even a coalition with the MHP, a party usually described these days as “nationalists.”

He was denied his majority by the HDP, once known as the paramilitary wing of the PKK terrorist organisation, now a Kurdish party that has begun to win support from liberal elements of Turkish society (some of whom voted tactically to ensure the HDP passed Turkey’s absurd 10 per cent electoral threshold). The parliament’s composition has changed radically: as well as more Kurds, there have also been more women, Christians and Yezidis elected, and Turkey’s first openly gay MP.

High living and corruption (his 1100-room presidential palace has been accused of housing a golden loo) will now haunt the President as he rattles around is enormous home, his own son being the most prominent target of an investigation Erdogan managed to stymie last year. It is quite possible that the mysterious “Ergenkron” case – ostensibly a mind-bogglingly elaborate conspiracy in which tens of senior military officers opposed to the AK just happened to be implicated – will now be unpicked.

The ten years of AK government did not entirely lack virtue. Illiberal pro-secularist legislation has been scrapped; the military has been subordinated to civil authority, and, most important, the economy made enormous strides thanks to political stability. But power, as it almost always does, went to this “authoritarian moderniser’s” head, and he and his circle began to enjoy the spoils of power, at some distance from the pious lower middle classes they originally represented.

What will happen to the man who would be Sultan? He will, I suppose, stay in that residence, large enough for a Central Asian despot but curiously undistinguished in its architecture. Will he manage somehow, however unconstitutionally, to transact government business or will we find him a few years hence roaming its corridors, long-since denuded of guards in sparkling Ottoman-era armour, on the hunt for the golden loo that infernal Kurd had accused him of installing? Would he come to believe he had actually installed that precious-metal WC, though having checked 319 bathrooms, he had been unable to locate it? What future would there be for those young men who lent such an air of grandeur to proceedings in their fine seventeenth century hats? And will he fear his enemies: the policemen he had taken off his son’s tail, the followers of Fetullah Gülen, the military men stitched up by Ergenkron, that “interest rate lobby” (will he still look back in satisfaction at that anti-semitic dog whistle?) and his internal rivals within the AK party, Abdullah Gul?

Erdogan’s pomp is over. Turkey’s chance to embed democracy has come.