Turkey’s Recep Tayyip Erdogan has suffered a blow in local elections, with his party losing control of the capital Ankara and an opposition party also claiming victory in Istanbul.
“If there are any shortcomings, it is our duty to correct them,” he said.
“Starting tomorrow morning, we will begin our work to identify our shortcomings and make up for them.”
The election came amid an economic downturn and was widely seen as a referendum on his leadership.
More than 57 million people in the country were registered to vote for mayors and councillors.
- Turkey country profile
- Why is Turkey fighting the markets?
- Erdogan: Turkey’s pugnacious president
Mr Erdogan had previously said the poll was about the “survival” of the country and his party, which has dominated Turkish politics for 16 years.
What are the results?
Turkish media said the secularist Republican People’s Party (CHP) candidate Mansur Yavas had won a clear victory in Ankara.
However both the CHP and Mr Erdogan’s Justice and Development Party (AKP) claimed victory by a slender margins in Istanbul, the country’s biggest city.
CHP candidate Ekrem Imamoglu said he had won by nearly 28,000 votes while the AKP said its candidate, former Prime Minister Binali Yildirim, was ahead by 4,000 votes.
Both candidates reportedly received more than 4m votes each.
The CHP also said it had held Izmir, Turkey’s third largest city.
What has the reaction been?
“The people have voted in favour of democracy, they have chosen democracy,” CHP leader Kemal Kilicdaroglu said.
Meanwhile Mr Erdogan, speaking to supporters in Ankara, hinted that the AKP may have lost control of Istanbul.
“Even if our people gave away the mayorship, they gave the districts to the AK Party,” he said.
‘Punishment for deepening recession’
Analysis by Mark Lowen, BBC Turkey Correspondent
There is a saying in Turkish: whoever wins Istanbul wins Turkey.
The biggest prize in the local elections is still too close to call, with a few thousand votes between the governing AK Party and the opposition CHP in a city of 18 million people.
The AKP candidate has declared victory, but there are still votes to count.
In the capital Ankara, the opposition has won back control after a quarter of a century. If it takes Istanbul too, it would be an astonishing result in a country where 90% of the media is pro-government and President Erdogan has branded his opponents “terrorists”.
His usually loyal conservative voters have punished him for a deepening recession, with inflation at 20% and the currency plunging in value.
For years Mr Erdogan appeared unbeatable, with a moribund opposition. Tonight, that image is beginning to change.
He vowed to focus his leadership on the Turkish economy ahead of national elections scheduled to take place in 2023.
Prominent journalist Rusen Cakir said the vote was “as historic as that of 1994”, referring to the year Mr Erdogan was elected mayor of Istanbul.
“It is a declaration that a page that was opened 25 years ago is being turned,” he said, according to Reuters.
How was the campaign?
This was the first municipal vote since Mr Erdogan assumed sweeping executive powers through last year’s presidential election.
The AKP have won every election since coming to power in 2002.
With most media either pro-government or controlled by Mr Erdogan’s supporters, critics believe opposition parties campaigned at a disadvantage.
The opposition pro-Kurdish Peoples’ Democratic Party (HDP) said the elections were unfair and refused to put forward candidates in several cities.
Some of its leaders have been jailed on terror charges, accusations they reject.
- Erdogan shows NZ attack video at rallies
- Turkey: Could the US damage its economy?
- Why Erdogan’s big ambitions could come tumbling down
Mr Erdogan’s rallies have dominated TV coverage. At one on Saturday, the president sought to reassure voters and the party’s usually conservative supporters that everything was under control.
“I am the boss of the economy right now as president of this country,” he said, also blaming the West and particularly the US for its financial turbulence.
The president was criticised for repeatedly showing footage from the recent terror attack in New Zealand, in which a self-declared white supremacist live-streamed himself killing 50 people at two Christchurch mosques.