Turkish Prime Minister Recep Tayyip Erdogan has won his country's first direct presidential election, provisional results show.
With almost all votes counted, Erdogan had won about 52%, against 38% for his main rival, officials said. He said the people had "shown their will".
Erdogan had been prime minister since 2003 and was barred from standing for another term. He needed more than 50% of the vote for an outright victory, avoiding a second round.
The BBC reported that turnout appears to be much lower than expected - some voters may have been dissuaded by the summer heat and holidays.
Erdogan's two rivals were a little-known diplomat, Ekmeleddin Ihsanoglu, and Kurdish politician Selahattin Demirtas.
Ihsanoglu, the joint candidate for the two main opposition parties in parliament, gained about 38% of the vote. Demirtas took about 9%.
Turkish television reports said the 60-year-old Erdogan, a devout Muslim, headed to a mosque to pray before an expected flight to the capital, Ankara, for a victory speech.
Erdogan is viewed by supporters as responsible for Turkey's economic advance while turning the country toward religious conservatism and away from its secular traditions. The prime minister said during the campaign he would exercise the full powers of the presidency under Turkey's existing laws, including the authority to call parliament, summon Cabinet meetings and appoint prime ministers, the council of ministers and some high court judges.
In the past, Turkey's presidents have been ceremonial figureheads, but Erdogan says he intends to change the constitution and establish an executive presidency. After casting his vote Sunday, he cited the importance of the election.
"This is very important for Turkey in terms of our political history, because it's a first. As we've repeatedly said before, for the first time our people will choose their president without an intermediary. In this regard it's very, very important," said Erdogan.
Religious conservatives, who are Erdogan's core supporters, see his rise to the presidency as the crowning achievement of his drive to reshape Turkey. As prime minister, he has broken the hold of the secular elite that dominated government since the founding of the modern Turkish republic in 1923 by Mustafa Kemal Ataturk.
The prime minister's critics are disturbed by his Islamist political roots and his increasingly authoritarian bent. In the past year, Erdogan has purged thousands of police and prosecutors, increased the powers of the country’s intelligence agency and banned access to YouTube and Twitter as he fought off corruption probes that implicated the government and family members.
Erdogan's campaign slogan was "national will, national power."
Erdogan’s years in office at the country’s prime minister were marked by the severe repressive measures that he implemented including encroachments on freedom of speech and communication. At one point, he outlawed the use of Twitter and Facebook to quash dissent amongst his political opponents.
On August 8, Erdogan publicly lashed out at a female journalist, calling her a “shameless woman.”
Just ahead of Sunday's presidential election Erdogan savaged Amberin Zaman, who writes for the Economist and the Turkish daily Taraf, over comments she made in a television debate. She had asked the main opposition leader Kemal Kilicdaroglu in the debate whether any Muslim society was capable of challenging its authorities.
Erdogan verbally attacked Zaman, without mentioning her directly by name, at an election rally in the eastern city of Malatya on Thursday. "A militant in the guise of a journalist, a shameless woman... Know your place!" he declared.
"They gave you a pen and you are writing a column in a newspaper... and you insult a society that is 99 percent Muslim," he said, drawing loud boos from the crowd.
This is not the first time Erdogan has lashed out at journalists, who have come under increasing pressure in Turkey, which has more reporters behind bars than any other country in the world.
Erdogan has also made a slew of anti-Semitic remarks over Operation Protective Edge in Gaza, and threatened to end the normalization process with Israel over “state terrorism.”
He has also accused Israel of "lies" because “not enough” Israelis have died in the conflict and has compared Jewish Home MK Ayelet Shaked to Adolf Hitler.
The American Jewish Congress has asked Erdogan to return an award it gave him in 2004 due to his criticism of Israel. The Turkish leader responded by saying he would be “glad” to return the award.