Image copyrightAFPImage caption
Recep Tayyip Erdogan has proved himself to be a formidable political operator

Glance at the front pages of the Turkish press and you get a sense of how this country has reacted to the most surprising election result in a decade.

While the pro-government Yeni Safak hailed a "glorious victory"; the opposition-leaning Cumhuriyet called it a "victory of fear". That shows the polarisation at the heart of Turkish society - and it is widely blamed on one man: President Recep Tayyip Erdogan.

He gambled with a re-run election - and won. But not completely. Mr Erdogan had urged a "super majority" of MPs for the party he founded, the AKP, to change the constitution and enhance his powers.

He needed 330 for a referendum on the move or 367 to force it through. In the end he managed 316.

It is still a healthy majority - but unless he convinces a mass defection from the far-right MHP Party, which haemorrhaged votes, the executive presidency he wanted will be shelved.

Pliancy

So where does that leave Turkey's great political survivor? He is still the country's first democratically-elected president, adored by his conservative supporters for bringing them economic empowerment and political representation.

When he left the post of prime minister in 2014, his replacement, Ahmet Davutoglu, was chosen for his pliancy. The two do not see completely eye to eye.

But the bookish Mr Davutoglu owes his position to Mr Erdogan and Turkey's president still calls the shots from his controversially opulent palace - at 1,000 rooms, four times the size of Versailles.

He will feel emboldened. And that, opponents fear, could deepen his authoritarianism, pushing on with a drive to muzzle opposition media and clamp down on critics. Dozens have already been charged with "insulting the president" since he was elected to office.

Two editors of Nokta, a magazine critical of Mr Erdogan, were detained on Monday and a media company was raided and taken over before the election.

Image copyrightAFPImage caption
Bookish Prime Minister Ahmet Davutoglu (centre) owes his position to Mr Erdogan and the president still calls the shots

Immediate challenge

The European Union has an "Erdogan dilemma": It is concerned by the decline in the rule of law here and crackdown on free speech.

But it is acutely aware of how crucial the alliance with Ankara is. It relies on Turkey to be the pillar of stability in a volatile Middle East.

Moreover, this is the main transit country for migrants and refugees heading to Europe. Any hope of solving crises in both regions depends on Turkey. Western governments may not like Mr Erdogan, but they need him.

The immediate challenge for the president and the new AKP government is to follow through on its election promise: to restore security after an upsurge in clashes with PKK Kurdish guerrillas.

Image copyrightAFPImage caption
The AKP has won a decisive victory but it does not have a big enough majority to change the constitution

A return to peace talks would involve both sides - and the president says it can only happen if the PKK disarms.

But there is significant anger among Kurds at the electoral re-run and the AKP's tactics of trying to paint the pro-Kurdish party, the HDP, as terrorists, scaring supporters to switch sides.

If that anger translates into continued violence, Mr Erdogan's message of "vote for us or get chaos" will sound increasingly hollow.

Recep Tayyip Erdogan is a formidable political operator.

After June's result, many were starting to write him off, to talk of a "post-Erdogan era", to spot the reformist wing within the party that could challenge his dominance.

It does exist and there is dissatisfaction among insiders - notably from the more conciliatory former President Abdullah Gul, who was widely tipped to attempt a return if the AKP failed to win a majority.

But Recep Tayyip Erdogan has bounced back and taken his support base with him. And Turkey's political bruiser is not going anywhere.