Turkey election: Challenges for Erdogan's third term
In his victory speech from his party headquarters in Ankara, Recep Tayyip Erdogan described his re-election as a victory for the entire country - and in a way he was right.
His Justice and Development Party (AKP) managed to increase its share of the vote to just under 50%, an impressive result for a party that has already been in power for more than eight years.
The main opposition Republican People's Party (CHP) increased its share of the vote too - its leader Kemal Kilicgaroglu says it won three and a half million new supporters.
And the Kurdish block, although it did not increase its share of the vote, won significantly more seats in parliament, with a number of outspoken Kurdish activists becoming MPs.
Only the hardline nationalist party, the MHP, lost some support.
But Turkey's proportional electoral system actually gave the AKP slightly fewer seats, crucially less than the 330 that would have allowed it to draft a new constitution on its own.
That means Mr Erdogan will have to bring the three opposition parties into the constitutional discussions to get the charter through parliament.
He will have to live up to the promise he made on Sunday night to be a humble and consensual prime minister, something his critics say he failed to do after the last election.
The project to write a new constitution is of crucial important to Turkey's future.
Most Turks acknowledge that the current charter, drafted under a military government 30 years ago, is inadequate for a maturing democracy.
But, while enormously popular among pious, provincial people, Mr Erdogan and his party do not inspire sufficient confidence among urban, secular Turks to be entrusted to draft the new constitution on their own.
In particular, they fear he has a conservative, religious social agenda, and they say he has failed to curb the authoritarian habits of the Turkish state.
The new Kurdish MPs are likely to push for early government action to ease the conflict in the mainly Kurdish south east.
They have a list of 10 demands they presented during their campaign, including greater autonomy, the right to be educated in the Kurdish language, and greater responsibility for their own security.
During his last term of office Mr Erdogan did announce a Kurdish initiative with bold promises to ease the tension between the Kurdish minority and the state. But nothing followed.
The Turkish courts continued to jail Kurds for the smallest show of separatist sympathy, and the army continued to attack positions of the Kurdish insurgent movement, the PKK.
Human rights concerns
Judicial reform is something else about which Mr Erdogan has talked a lot, but is accused of doing little.
People are routinely arrested and imprisoned for actions that in most countries would fall under freedom of expression.
The government has argued that it is powerless to tame the judiciary, that it too has fallen victim to overzealous judges and prosecutors.
But many of those who have been imprisoned in recent years are staunch opponents of the government.
In this term the prime minister will have to show greater willingness to reform the judiciary, even in ways that give his critics more freedom to speak out, if he is to convince them that his commitment to democracy is heartfelt.
The economy is one area where Mr Erdogan has good cause to be proud, and it was undoubtedly the main foundation of his electoral success.
But even there, with growth rates close to China's, the picture is not entirely rosy.
With greater confidence has come a consumer spending boom, which risks overheating the economy. And there are millions of Turks who have not yet derived much benefit.
Unemployment, especially among the young, in what is a very young country, is stubbornly high.
Mr Erdogan presented some ambitious development projects during his campaign, including a plan to build a canal from the Black Sea to the Sea of Marmara, and an entirely new city outside Istanbul.
That should create some jobs. His party's addiction to construction, though, is bringing it into conflict with an emerging environmental movement.
His mandate is an impressive one. But Mr Erdogan does have a very full in-tray.