Turkey’s battle for the presidency looks set to go to a run-off, with both contenders adamant they have victory in their grasp.
After 20 years in power, Recep Tayyip Erdogan stood on the balcony of his party HQ saying he was convinced he would win another five.
Everything appeared to have fallen into place for his opponent Kemal Kilicdaroglu to win.
But incomplete results put him behind the president in the first round.
And Mr Erdogan’s alliance could also be heading for a majority in parliament.
For months, Turkey’s disparate opposition parties had pooled their resources in a bid to bring an end to a president who has extended his power dramatically since a failed coup against him in 2016.
The election is being watched very closely in the West, because Mr Kilicdaroglu has promised to revive Turkish democracy as well as relations with its Nato allies. On the other hand, President Erdogan’s Islamist-rooted government has accused the West of plotting to bring him down.
In the early hours of Monday, Mr Kilicdaroglu stood on a stage at his party headquarters in Ankara, flanked by his allies but appearing less confident than before.
“If our nation says second round, we will absolutely win in the second round,” he said.
Supporters outside party headquarters chanted one of his slogans, “everything will be all right”, but it was not clear for them that it would.
He had earlier angrily accused the government of seeking to “block the will of the people”, by launching repeated challenges in opposition strongholds. Two risings stars in the party, the mayors of Istanbul and Ankara, reminded voters that this was a strategy that Mr Erdogan’s AK Party had used before.
They praised an enormous team of opposition volunteers guarding ballot papers to ensure nothing untoward happened to the votes.
Mr Kilicdaroglu, 74, has lost several elections as leader of his Republican People’s Party, but this time his message of scrapping the the president’s excessive powers struck a chord.
Turks have also been reeling from a cost-of-living crisis with 44% inflation, made only worse by Mr Erdogan’s unorthodox economic policies.
And then the Erdogan government was blamed for a slow rescue response to the double earthquakes in February which killed more than 50,000 people in 11 provinces.
And yet, despite a very difficult few months, Turkey’s dominant president appears to have the upper hand.
Addressing supporters from the balcony he had used for previous victories he announced that “even though the final results are not in, we are far ahead”.
Whether or not he does take a lead into an expected run-off two weeks ahead, the president appears to have defied many pollsters who said his rival had the edge and could even win outright without a run-off.
He could also be heading for a majority in parliament, along with his nationalist MHP ally, according to unconfirmed results quoted by state news agency Anadolu.
His supporters ridiculed the opposition allies first for declaring that Mr Kilicdaroglu would become the 13th Turkish president, and then for gradually lowering their expectations as the night progressed.
What this result does confirm is the extent to which Turkish society has become polarised, 100 years since Kemal Ataturk’s foundation of the modern Turkish republic.
In the final hours before voting began, Mr Kilicdaroglu rounded his campaign off with a trip to Ataturk’s mausoleum in Ankara.
President Erdogan instead chose to make a very symbolic statement to his conservative and nationalist support base, by making a campaign speech at Hagia Sophia in Istanbul. Ataturk had turned the former Orthodox Cathedral into a museum, but in 2020 Mr Erdogan made it a mosque.
It is unclear how close the expected run-off will be, and there is already considerable speculation over what will happen to the 5% of votes that went to the third candidate in the election, ultranationalist Sinan Ogan.
He knows both leaders will be trying to court him and is bound to set some tough conditions.
It is far from certain that even if he does endorse either candidate the first-round voters he attracted will do the same.