Recep Tayyip Erdogan's landslide election triumph on Sunday puts paid to any question about his legitimacy. As the Hurriyet newspaper, a traditional voice of the secular, liberal elites, put it: "He has been embraced by the people".

His is not only a personal victory but a huge stride forward for Turkey. Turkish voters have passed judgment on the dangerous confrontation over electing a new president between the army and Mr Erdogan's neo-Islamist Justice and Development party (AKP). They have come out decisively for democracy.

The AKP raised its share of the vote by more than 12 percentage points to nearly 47 per cent. That is not only because of popular repudiation of a musclebound military, or even the Erdogan government's successes in modernising the constitution and growing the economy. The ruling party has moved deftly into alignment with the people.

When the AKP was being put together, a survey of 41,000 people showed that concerns such as entry into Europe and the economy far outweighed emotive and divisive issues like Islamic headscarves for women - except among the headbangers of the failed Islamist movements the party was designed to supersede. These elements - including close to half of outgoing MPs - have now been extensively purged.

The AKP is now a national conservative party - albeit rebalancing power away from the westernised urban elite and towards Turkey's traditional heartland of Anatolia - as well as the Muslim equivalent of Europe's Christian Democrats.

It would be all too easy for Mr Erdogan, after so convincingly winning an election called to assert his authority over the army, to try to impose his choice for the presidency: Abdullah Gul, his talented foreign minister. He should remember that the success of his party is built on its reputation for restraint.

He should make good on pre-poll hints of a compromise president, as well as his post-election pledge to govern for all Turks. He needs, in any case, to work with the nationalist and Kemalist opposition to get his reforms through parliament. That will not be easy.

The Republican People's party of Mustafa Kemal Atatürk, founder of modern Turkey, has ossified into a xenophobic sulk, while the nationalists seem set on sabotage of Ankara's already stalled negotiations on European Union accession.

What could really break Turkey's ties with the EU, as well as the US, however, would be if the army carries out its threat to invade northern Iraq to crush Kurdish separatists. Mr Erdogan will need all his enhanced authority to forestall this.