Results are so far extremely close in Turkey’s local elections, which are widely seen as a referendum on President Recep Tayyip Erdogan.
The opposition CHP candidate for mayor has claimed a narrow victory in Ankara, where 91.4% votes have been counted.
In Istanbul, the governing AK Party said it had won a tight victory by less than one percentage point.
“If there are any shortcomings, it is our duty to correct them,” said President Erdogan, as results came in.
“Starting tomorrow morning, we will begin our work to identify our shortcomings and make up for them.”
However, he maintained that his AK Party (Justice and Development Party, AKP) had come “top by far”.
“Results show that, as the AKP, we emerged from this election as the top party by far, just as has been the case since the 3 November 2002 election,” the president said.
In Istanbul, the AK party has 48.71% of the vote compared to CHP’s 48.65%, but a few votes are still to be counted.
But opposition CHP candidate Ekrem Imamoglu said: “I know we won in Istanbul, it is very clear.”
More than 57 million people in the country were registered to vote for mayors and councillors in the election, which came amidst an economic downturn.
President Erdogan had previously said the poll was about the “survival” of the country and his party, which has dominated politics for 16 years.
This was the first municipal vote since Mr Erdogan assumed sweeping executive powers through last year’s presidential election.
But polls in the lead-up to the election had already showed a tight contest emerging in Ankara between the CHP mayoral candidate Mansur Yavas and AKP candidate Mehmet Ozhaseki.
In election-related violence, dozens of people were injured in clashes across Turkey. Two people were shot dead at a polling station in the eastern city of Malatya. Local reports say a fight broke out after a man refused to use a polling booth, preferring to vote in the open.