Turkey's ruling AKP trailing in Ankara vote, dead heat in Istanbul
With 88 percent of the ballot boxes counted, the joint opposition candidate for Ankara mayor was ahead with 50.35 percent of votes, the AKP on 47.43 percent, Anadolu state agency reported citing preliminary results.
The AKP candidate for Istanbul mayor with 48.88 percent of votes was in a dead heat with the opposition contender on 48.50 percent, with 97 percent of ballot boxes counted, the agency said.
Erdogan and his Justice and Development Party (AKP) have won every vote since the party first came to power in 2002, but this time, analysts say, the party had risked losing Ankara and faced a challenge in Istanbul as an economic slowdown took hold.
"Every gain and every loss is the will of our people and also a requirement of democracy that should be acknowledged," Erdogan said in Istanbul before heading to Ankara to make a post-election speech.
"We will admit we won the hearts of our people in areas that we won and we will admit we were not successful enough in areas that we lost."
Sunday's poll was the first municipal ballot since Turks approved constitutional reforms in 2017 to create an executive presidency that gave Erdogan wider powers after 16 years in office.
But Erdogan, whose ability to win continuously at the polls is unparalleled in Turkish history, was more vulnerable with the economy in recession, unemployment higher and inflation in double digits.
Voting closed at 1400 GMT in Sunday's elections, which were held mostly without incident, with the exception of the deaths of two men killed in a fight at a polling station in the east of Turkey.
Much of the AKP's success has been down to Erdogan's perceived economic prowess, but days before the vote, the Turkish lira was sliding again, provoking memories of the 2018 currency crisis that badly hurt Turkish households.
Erdogan, who began his own political career as Istanbul mayor, personally campaigned hard across Turkey, often with several rallies a day, even though he was not on the ballot.
Looking to galvanise his base among conservative Turks, the president cast the election as a matter of survival, attacking opposition candidates by branding them as linked to PKK Kurdish militants.
But for voter Husnu Acar, 53, casting his ballot at a school in Beylikduzu on the outskirts of Istanbul, "they (AKP) are the ones with a survival problem."
"The economy is terrible," he said.
Voters on Sunday elected scores of mayors, municipal councils and other local officials.
In Istanbul, the country's biggest city and economic hub, Erdogan fielded one of his loyalists, former prime minister Binali Yildirim.
But in Ankara, Mansur Yavas - the candidate for both the opposition Republican People's Party or CHP and the nationalist Good Party - had been slightly ahead in some recent opinion polls.
During voting, two members of Saadet (Felicity), a religiously conservative party, died after a fight between two groups in Puturge in eastern Turkey, private DHA news agency reported. The Malatya governorate said four individuals were detained.
Economic worries
For his supporters, Erdogan remains the strong leader they believe Turkey needs and they tout the country's economic development over the years he and the AKP have been in power.
But rights activists and even Turkey's Western allies say that under Erdogan's leadership, democracy has been eroded, particularly after a failed 2016 coup that led to tens of thousands of people being arrested.
"The economy isn't doing so good for sure, but I have confidence in our president and things will be better after the election," said Koksal Karacan, a retiree voting in Istanbul's Kasimpasa, where Erdogan grew up.
The vote was the first time since 2002 that the AKP is fielding candidates with its alliance partner, the rightwing Nationalist Movement Party (MHP).
The opposition pro-Kurdish Peoples' Democratic Party (HDP) has refused to field candidates in several cities, saying the elections are unfair. Some of its leaders have been jailed on terror charges, accusations they reject.
Observers say that with most media pro-government, opposition parties campaigned at a disadvantage because Erdogan's daily rallies dominated TV coverage.
With inflation at just under 20 percent and unemployment at a near 10-year high in December, Erdogan had sought to reassure voters about the economy. He blamed the lira currency fall on a campaign to undermine Turkey, led by the United States.
Turkey's finance minister Berat Albayrak, who is Erdogan's son-in-law, has said economic reforms would be announced the week of April 8.