Prime Minister Recep Tayyip Erdogan on Monday prepared to take Turkey to a promised "new era" when he assumes the presidency in just over two weeks, after vanquishing his election rivals in a historic poll victory.
Erdogan vowed to build a "new Turkey" and reconcile a divided country as he took to the balcony of his party headquarters in Ankara to give a triumphant midnight speech before tens of thousands of supporters.
But analysts have warned both he and Turkey may face turbulent times ahead as he prepares to beef up the powers of the president, which in recent years has been a largely ceremonial role.
Erdogan has served as premier since 2003, a period in which he has sought to modernise Turkey and take a more assertive position on the international stage. He could now serve two five year presidential terms, staying in power until 2024.
Sunday's polls were the first direct presidential elections in Turkish history -- previously the head of state was chosen by parliament -- and Erdogan has said he will be a "people's president."
"The Turkish people wrote history yesterday," declared the pro-Erdogan daily Sabah, with a picture of Erdogan giving the balcony speech with his hand clasped to his heart.
He will be inaugurated as president on August 28 and attention now will turn to who becomes the next prime minister to take the ruling Islamic-rooted Justice and Development Party (AKP) into 2015 legislative elections.
Also closely watched will be the future of outgoing president Abdullah Gul, a co-founder of the AKP with Erdogan, who has taken a distance from the premier and is keeping his future plans tightly under wraps.
'First step in new era'
In the end, Erdogan's victory was not the processional landslide many predicted but he still managed with a comfortable cushion to avoid the need for a second round against the main opposition challenger Ekmeleddin Ihsanoglu.
Erdogan won 51.74 percent of the vote, Ihsanoglu 38.46 percent and the third candidate, Kurdish challenger Selahattin Demirtas 9.80 percent, according to results based on a near total vote count.
Turnout was 73.68 percent, a figure that would be considered high in many countries but was sharply down on the 89 percent turnout recorded in Turkey's local elections in March.
Critics complained that the campaign had been strongly slanted in favour of Erdogan, whose advertising dominated television and billboards for days in the run-up to the polls.
"Erdogan has become the first president directly elected by the people, after an unfair election process," said the strongly secular Cumhuriyet daily.
Thousands of Turks took to the streets of Istanbul hooting the horns of their cars and waving Turkish flags to celebrate the victory of Erdogan while fireworks exploded in the skies above Ankara in celebration.
In his speech from the balcony of AKP headquarters -- already a tradition after Erdogan election victories -- he sought to promote a message of reconciliation after a sometimes bitter election campaign.
"Today we are closing an era and taking the first step for a new era," Erdogan said in his victory speech.
Promising a new process of social reconciliation, he added: "We may have different political views, different lifestyles, sects, values, ethnic roots... but we are all sons of this country... each of us are the owner of this state."
Troubled times ahead?
During his first term as president, Erdogan will mark being in power longer than Mustafa Kemal Ataturk, who founded the modern Turkish state in 1923 and is still hailed as the country's national hero.
Erdogan clearly has his eye on going down in history as a transformative figure like Ataturk, planning eye-poppingly ambitious infrastructure projects including a new canal for ships in Istanbul, a third airport in the city and a high speed rail network for the entire country.
Yet many secular Turks bitterly resent his rule and accuse Erdogan of squandering Ataturk's legacy with a gradual move to Islamise the country and impose one-man rule.
Their anger erupted to the surface in deadly 2013 protests sparked by plans to build a shopping mall on the site of Gezi Park in central Istanbul. There was no reported unrest on election night.
In his victory speech, Erdogan called on opponents who label him a "dictator" to question themselves instead of criticising him.
He has promised to be a strongman president but this will prove tricky within the limits of the current constitution and the AKP has vowed to move to seek a new basic law after the 2015 polls. Beyond that, Erdogan faces other tough challenges before him.
The economy, whose success is the foundation of his political popularity, has begun to show weakness over the last months.
"Winning the presidency has never been the main challenge for Erdogan. The main challenge... is what happens next," said Ziya Meral, a researcher on Turkey at the University of Cambridge and Foreign Policy Centre in London.