Turkish Prime Minister Recep Tayyip Erdogan promised the start of a "new era" after winning presidential elections in an easy triumph, despite fears the country is creeping towards one-man rule.
With Turkey still deeply polarised after bitter 2013 protests, Erdogan has vowed to shake up the country's political system to make the president its number one figure.
He won 52.0% in Sunday's vote, according to a count of 99% of ballots. That was way ahead of his main opposition rival Ekmeleddin Ihsanoglu, on 38.3%, and means there will be no second round.
The third contender, Kurdish candidate Selahattin Demirtas, won 9.7% of the vote. Erdogan's inauguration is set for August 28.
The result marked a personal triumph for Erdogan, 60, who has served as premier since 2003 and could be president for two mandates, until 2024.
Thousands of people filled central Istanbul waving Turkish flags and holding Erdogan pictures to celebrate his victory as fireworks lit up the sky over the capital Ankara.
"Today we are closing an era and taking the first step for a new era," Erdogan said in his victory speech from the balcony of his party headquarters in Ankara, describing the election as a "historic day".
"It is not only Recep Tayyip Erdogan who won today. Today, national will has won once again. Today, democracy has won once again," he declared.
He was joined by top party officials and ministers, as well as his headscarf-wearing wife Emine and the president of Kyrgyzstan, Almazbek Atambayev.
Erdogan promised a "new social reconciliation process" where all Turks of whatever origin or belief would be equal citizens of the country.
"I will be a president who wholeheartedly embraces 77 million people, as I have done all through my life and all through my political struggle," he said.
Erdogan also called on opponents who label him a "dictator" to question themselves instead of criticising him.
The political opposition should "review their policies" in order to overlap with his "new Turkey" ideal, he said. "Those who accuse us of one-man rule ... should please question themselves sincerely."
His margin of victory was narrower than expected by some analysts, and Ihsanoglu's bid held up despite a low-key campaign that was dwarfed by Erdogan's drive for votes.
The polls were the first time Turkey -- a member of NATO and longtime hopeful to join the EU -- has directly elected its president, who was previously chosen by parliament, and Erdogan had hoped for a massive show of popular support.
'Democracy lost in polls'
Erdogan has said he plans to revamp the post to give the president greater executive powers, which could see Turkey shift towards a system more like that of France if his Justice and Development Party (AKP) succeeds in changing the constitution.
But Erdogan's opponents accuse him of undermining the secular legacy of Turkey's founding father Mustafa Kemal Ataturk, who established a strict separation between religion and politics when he forged the new state from the ashes of the Ottoman Empire.
"It is not Ihsanoglu who lost the elections, but the longing for clean and honest politics and a quest for democracy," said Haluk Koc, the spokesman for the Republican People's Party which backed Ihsanoglu, denouncing Erdogan's "oppressive mindset".
Ihsanoglu -- a bookish former head of the Organisation of Islamic Cooperation (OIC) -- conceded defeat and offered his congratulations to Erdogan, but insisted his campaign had made an impact.
"This is a very remarkable result because when we launched our campaign one month ago, everyone said we don't know Ihsanoglu, he doesn't know anything about politics."
While many secular Turks detest Erdogan, he can still count on a huge base of support from religiously conservative middle-income voters, particularly in central Turkey and poorer districts of Istanbul, who have prospered under his rule.
Regional breakdowns of the results showed a clear geographical polarisation in the country, with Ihsanoglu taking the strongly secular western coast, Demirtas the Kurdish southeast, but Erdogan the Black Sea coast, Istanbul and the entire heart of the country.
Demirtas, 41, had hoped to attract votes not just from Kurds but also secular Turks with a left-wing, pro-gay and pro-women's rights message.
His charisma, flashing grin and fondness for white shirts with rolled-up sleeves earned him the moniker "the Kurdish Obama" in some quarters.
His respectable result may provide a springboard for Turkey's next political battle, legislative elections in 2015, and Demirtas expressed hope his People's Democratic Party (HDP) would gain mass appeal.
"The elections have created excitement about the possibility that this hope can really be long lasting in Turkey," he said.
'Challenges ahead for Erdogan'
Erdogan endured the toughest year of his rule in 2013, shaken by deadly mass protests sparked by plans to build a shopping mall in Gezi Park, one of the last green spaces in central Istanbul, that grew into a general cry of anger by secular Turks who felt ignored by the AKP.
Later in the year, stunning corruption allegations emerged against the premier and his inner circle, including his son Bilal, based on bugged conversations that enthralled the country like a soap opera.
The future of outgoing president Abdullah Gul, a co-founder of the AKP who appears to have distanced himself from Erdogan, is unclear. Foreign Minister Ahmet Davutoglu is tipped as a possible choice to be premier.
But analysts warned that Erdogan may face stiff resistance when he seeks to change the constitution and gain extra powers for the presidency.
"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 University of Cambridge and Foreign Policy Centre in London.