Turkey's landmark election is headed to a likely run-off following a stormy night in which President Recep Tayyip Erdogan's secular rivals contested the ballot count.
The Anadolu state news agency showed the 69-year-old conservative leader on 49.86% and his secular rival Kemal Kilicdaroglu trailing with 44.38%.
Anadolu's figures were based on a count of 90.6% of the ballot.
One or other of the candidates needed to break the 50% threshold to avoid Turkey going to its first election run-off in the post-Ottoman republic's 100-year history on 28 May.
But the secular opposition camp, spearheaded by Mr Kilicdaroglu, cried foul.
"We are leading," the 74-year-old tweeted.
Leading opposition figures said the government was purposely slowing down the count in districts where Mr Kilicdaroglu was enjoying strong support.
"They are contesting the count emerging from ballot boxes where we are massively ahead," Istanbul's opposition mayor Ekrem Imamoglu told reporters.
We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences
Mr Imamoglu said the opposition's internal vote count showed Mr Kilicdaroglu picking up 49% of the vote and Erdogan just 45%.
But neither the state media count nor the one presented by the opposition avoids the possibility of Turkey holding another presidential vote in two weeks.
Huge turnout

Turnout was expected to be huge in what has effectively become a referendum on Turkey's longest-serving leader and his Islamic-rooted party.
Mr Erdogan has steered the nation of 85 million through one of its most transformative and divisive eras in the post-Ottoman state's 100-year history.
Turkey has grown into a military and geopolitical heavyweight that plays roles in conflicts from Syria to Ukraine.
The NATO member's footprint in both Europe and the Middle East makes the election's outcome as critical for Washington and Brussels as it is for Damascus and Moscow.

Mr Erdogan is lionised across swathes of conservative Turkey that witnessed a development boom during his rule.
More religious voters are also grateful for his decision to lift secular-era restrictions on headscarves and introduce more Islamic schools.
"My hope to God is that after the counting concludes this evening, the outcome is good for the future of our country, for Turkish democracy," Mr Erdogan said after casting his ballot in Istanbul.

Mr Erdogan's first decade of economic revival and warming relations with Europe was followed by a second one filled with social and political turmoil.
He responded to a failed 2016 coup attempt with sweeping purges that sent chills through Turkish society and made him an increasingly uncomfortable partner for the West.
The emergence of Mr Kilicdaroglu and his six-party opposition alliance - the type of broad-based coalition that Mr Erdogan excelled at forging throughout his career - gives foreign allies and Turkish voters a clear alternative.
A run-off could give Mr Erdogan time to regroup and reframe the debate.
But he would still be hounded by Turkey's most dire economic crisis of his time in power, and disquiet over his government's stuttering response to the February earthquake that claimed more than 50,000 lives.
"We all missed democracy," Mr Kilicdaroglu said after voting in the capital Ankara.

"You will see, God willing, spring will come to this country."
'Can't see my future'
Polls did show Mr Kilicdaroglu winning the youth vote -- nearly 10% of the electorate - by a two-to-one margin.
"I can't see my future," university student Kivanc Dal told AFP in Istanbul on the eve of the vote.
Mr Erdogan "can build as many tanks and weapons as he wants, but I have no respect for that as long as there is no penny in my pocket".
But nursery schoolteacher Deniz Aydemir said Mr Erdogan would get her vote because of the economic and social progress Turkey made after half a century of corruption-riddled secular rule.
The 46-year-old also questioned how a country could be ruled by a coalition of six parties - a favourite attack line of Mr Erdogan during the campaign.
"Yes, there are high prices... but at least there is prosperity," she said.
Mr Erdogan's campaign became increasingly tailored to his core supporters as election day neared.
He branded the opposition a "pro-LGBT" lobby that took orders from outlawed Kurdish militants and was bankrolled by the West.

Mr Erdogan's ministers and pro-government media referred darkly to a Western "political coup" plot.
The opposition began to worry that Erdogan was plotting how to hold on to power at any cost.
Mr Erdogan bristled when asked on Friday night television if he would agree to leave if he lost.
"This is a very silly question," he fumed.
"We would do what democracy requires."