VOA's Turkish and Kurdish services contributed to this report.
ISTANBUL -- Turkish President Recep Tayyip Erdogan’s Justice and Development Party (AKP) suffered significant losses in local elections Sunday, including loss of control of the capital Ankara.
In Istanbul, election results remain too close to call, with both sides claiming victory.
Erdogan, speaking in Istanbul to reporters, acknowledged the AKP had suffered setbacks and vowed to learn "lessons" from the poll.
"We had some wins; we had some losses," he said. Erdogan went on to promise to introduce measures to boost the economy, which is mired in recession.
Possible defeat in Ankara
Some analysts see Erdogan's avoidance of his traditional fiery rhetoric against the opposition Republican People's Party (CHP) as a sign of accepting defeat in the capital Ankara.
Ankara's CHP candidate, Mansor Yavas, appears set for a historic but narrow victory for the opposition.
In addressing thousands of supporters gathered in the heart of the capital, Yavas gave a conciliatory speech, promising to focus on services, adding there would be no purge of workers with ties to the AKP.
In Istanbul, the contest remains mired in controversy. AKP candidate Binali Yildirim claimed victory in a short speech. However, CHP candidate Ekrem Imamoglu immediately shot back, saying it was shameful to claim success, given that only a few thousand votes separate the candidates and some ballots remain uncounted.
Imamoglu called on his supporters not to sleep for the next 48 hours, warning their victory was being stolen from them.
Earlier Sunday evening, Imamoglu challenged the integrity of the counting of the vote, claiming there were disparities in results in the announced elections.
With 98.5% of votes counted in Istanbul, results appeared frozen with no update for several hours. Most of the outstanding uncounted ballots are in CHP strongholds.
Recent elections in Turkey have been marred by controversy over voter manipulation and outright fraud allegations by the opposition, a charge denied by the governing AKP. Critics, however, claim the Supreme Electoral Board, which administers elections, is run by the government and presidential appointees.
Sunday evening, the electoral board stopped sending results to the opposition parties for 40 minutes, claiming it was upgrading its system. Leading members of the opposition party went to the electoral board headquarters, demanding an explanation.
Beyond Ankara and Istanbul, the AKP lost several key provincial cities, while narrowly avoiding defeat in many others. Several other important results remain in the balance.
The AKP appears to be paying a heavy price for an economy in recession and soaring inflation.
"Our economy is getting worse and worse because of their (government) bad management," said Erdem, an engineer, speaking before voting in Istanbul. "Most of my friends are now looking for a job and some my friends lose their job because of economic crisis."
Voters in Ankara spoke about the country's economic problems.
"The youth in this country are unemployed. We know the hardships of people who don't have a job. The only solution to this is creating jobs," Orhan Kurubacak told VOA.
"I don't think things are going well. There is nothing more else to say. There are a lot of economic factors," Hakan Akyürek said.
Diyarbakir AKP candidate, Cumali Attila, told VOA's Kurdish service, "I hope these elections would end with gumption. It is our responsibility to claim democracy."
The pro-Kurdish People's Democratic Party (HDP) heavily defeated Attila. However, the AKP scored some crucial victories in the predominantly Kurdish southeast, winning key provinces. In Sirnak, the AKP won with a 30 percent swing to the party from the HDP.
Such success will likely do little to soften the blow Erdogan has suffered in the Sunday polls. Even though Erdogan was not on the ballot, he took personal control of the local election campaign. In the last few days held more than a dozen rallies across Istanbul in a bid to consolidate his party's support.
Realities in country
Despite such efforts, analysts say Erdogan could not escape the economic realities facing the county.
"I think that the most powerful and effective opposition parties are not the classical parties, like the Republican People's Party or the Good Party. However, the key issue for the elections is the increasing prices of vegetables. Let's say the prices of cucumbers or tomatoes. These are the most effective oppositions of Turkey," Doster added.
The loss of Ankara and possibly Istanbul is the worst electoral defeat for Erdogan, who has enjoyed unparalleled success. Analysts say Erdogan's reputation of electoral invincibility has received a significant blow.
Meanwhile, HDP co-chair Pervin Buldan said votes cast Sunday for her party "will contribute to peace, freedom and equality."
Buldan said, however, obstacles their party faced, such as receiving no television coverage during the election, might not be enough to win.
"Every day we tried to clear and explain the truths told our people about the lies, slanders, threats and the perception that created against us. We did our duty today. I believe that our people will do their duty at the polls, too," she said.
WATCH: Turkey local elections