Turkey’s powerful president, Recep Tayyip Erdogan, will go head to head with his opposition rival in a run-off vote, the supreme election council has confirmed.
Mr Erdogan led the first round with 49.51% of the vote, its chairman said.
Although he had a clear lead over his main challenger Kemal Kilicdaroglu, who polled 44.88%, he needed more than half the vote to win the race outright.
A second round will go ahead on 28 May, with Mr Erdogan the clear favourite.
Shortly before the announcement by election council leader Ahmet Yener, the president’s rival appealed to supporters not to “fall into despair” and to stand and take on the election together.
But it was not immediately obvious how the opposition Nation Alliance could narrow a margin of almost five points in just two weeks. Although the third candidate, ultranationalist Sinan Ogan, polled 5.17% it seemed unlikely that all his voters would switch to the centre-left-led opposition.
Mr Erdogan has been in power in Turkey for more than 20 years, first as prime minister and then as president, extending his powers still further after a failed coup in 2016.
Many opinion polls had suggested his rival was on course to win the first round, and Erdogan supporters celebrated outside party headquarters in Ankara long into the night.
Addressing them from the balcony, he told them he had won 2.6 million more votes than his chief rival.
With Mr Kilicdaroglu as candidate, the opposition was seen as having its best chance so far at removing him from power. It drew together a broad-based alliance of parties and offered an end to soaring inflation and Mr Erdogan’s system of an all-powerful presidency.
But initial confidence in victory turned to disappointment and the opposition leader did his best to rally supporters by declaring “we will absolutely win in the second round”.
Mr Yener said all of the ballot boxes from Sunday’s vote had been opened and turnout in Turkey was 88.92%. However, it was clear that a number of votes cast abroad had not yet been counted.
The international monitoring group OSCE highlighted several flaws in the election, pointing out that Mr Erdogan and the ruling parties had enjoyed “an unjustified advantage”.
Although the monitors praised the high turnout and political choice, they said the vote had been limited by an unlevel playing field. They singled out “biased media coverage”, as well as intimidation of the pro-Kurdish party and the jailing of its former joint leader and that of philanthropist Osman Kavala.
Another issue they highlighted was the limited help given to survivors of February’s earthquakes to take part in the election.
Mr Erdogan was widely criticised for the state’s slow response to the disaster, which left more than 50,000 people dead.
But it had little effect on election results in the eight cities seen as strongholds of his AK Party in the earthquake zone. In seven of the cities the president’s support remained above 60%. Only in Gaziantep did it slip to 59%.
Sunday’s vote was not only for the presidency but for the 600 seats in parliament too. And here too the Erdogan party had a good night, heading for a majority of about 317 seats.
Attention has now switched to the 2.79 million ballots cast for Sinan Ogan, who told BBC Turkish that without him the presidential race would have been over in one round, implying that Mtr Erdogan would have won outright.
He was remorseless in his criticism of the opposition for failing to win when the ruling party was struggling with so many setbacks, from the economy to the earthquakes and the two decades of Erdogan rule.
Even if he were to act as a kingmaker by endorsing one candidate or the other, it is far from certain that his first-round voters would follow his suggestion.