Turkish President Recep Tayyip Erdogan's ruling party suffered a major upset on Monday after local election results showed it lost the capital Ankara and Istanbul after a decade and half in power.
Losing the country's two major cities would be a stunning defeat for Erdogan, a former Istanbul mayor himself, whose ability to win at the ballot box has been unparalleled in Turkish history.
Erdogan campaigned hard, portraying Sunday's vote for mayors and district councils as a fight for the nation's survival, but the election became a test for his Justice and Development Party (AKP) after Turkey slipped into a recession for the first time in a decade.
The opposition CHP party candidate for Istanbul mayor, Ekrem Imamoglu, was leading by nearly 28,000 votes with most ballot boxes counted, Supreme Election Board (YSK) chairman Sadi Guven said.
Imamoglu won almost 4.16 million votes while the AKP candidate, former premier Binali Yildirim, won 4.13 million.
Both claimed victory in the early hours following a tight race for the country's largest city after results showing them in a dead heat.
"We want to start working as soon as possible to serve people," Imamoglu told reporters on Monday.
"We want to cooperate with all institutions of Turkey to quickly meet the needs of Istanbul."
AKP secretary general Fatoih Sahin said the party will appeal in Ankara, saying the gap between the candidates "will narrow down and I believe it will eventually turn into a positive result for us."
"They have retained their 51 per cent majority in total, which is very important. Had they not, this would lead into a questioning of their legitimacy."