President Recep Tayyip Erdogan’s Islamic-based party has gained 46% of the votes, according to state broadcaster TRT.
President Recep Tayyip Erdogan’s ruling party is leading in Turkey’s municipal elections but may lose control of the capital in a vote seen as a test of his support amid a sharp economic downturn.
Mr Erdogan’s conservative, Islamic-based party, gained 46% of the votes in the elections, with more than half of the more than 194,000 ballot boxes counted, according to state broadcaster TRT. The main, secular-oriented opposition party was said to have taken 30.5%.
But the opposition is leading in the capital, Ankara, with 49.5% of the votes, according to TRT, in a setback for Mr Erdogan, whose ruling party and its predecessor have held the mayoral seat for 25 years.
Mr Erdogan’s party appeared to be holding Istanbul still, the country’s commercial hub, although the opposition’s candidate had narrowed the gap.
The voting was marred by scattered election violence that killed at least four people and injured dozens of others across Turkey.
Unofficial final results were expected late on Sunday.
Economic prosperity has provided Mr Erdogan and his party with previous election victories.
But the party faces the risk of losing mayoral seats in the elections taking place in 30 large cities, 51 provincial capitals and hundreds of districts, as Turkey grapples with a weakened currency, a double-digit inflation rate and soaring food prices.
The local contests’ high stakes were brought into sharp focus with the deaths of two members of the Islamic-oriented Felicity Party, a small rival of the president’s Justice and Development Party.
Felicity’s leader, Temel Karamollaoglu, alleged that a polling station volunteer and a party observer had been shot by a relative of a ruling party candidate.
The killings were not caused by “simple animosity”, but happened when the volunteers tried to enforce the law requiring ballots to be marked in private voting booths instead of out in the open, Mr Karamollaoglu tweeted.
Speaking to reporters after he had voted, Mr Erdogan said he was sad about the deaths and did not want them to become a cause for “a questioning or a judgment between political parties”.
Two other people were killed in fighting in the southern city of Gaziantep.
Fights related to local elections in several provinces also led to dozens of injuries, Turkey’s official Anadolu news agency reported.
At least 21 people were injured in southeastern Diyarbakir province from brawls over the election of neighbourhood administrators, Anadolu said.
The exact causes of the fights remained unclear.
Election campaigning was highly polarised, with Mr Erdogan and other officials using hostile rhetoric toward opposition candidates.
Sunday’s elections were a first test for Mr Erdogan since he won re-election under a new system of government that gave the presidency expanded powers.
Mr Erdogan’s ruling party has renewed an alliance with the country’s nationalist party to increase votes.
Opposition parties also coordinated strategies and put forward candidates under alliances in an effort to maximise the chances of unseating members of the Justice and Development Party, known in Turkish by the acronym AKP.
Ankara was considered the main battleground in the race and opinion polls suggested the candidate of the opposition alliance, Mansur Yavas, could end the 25-year rule of AKP and its predecessor.
A former government environment minister, Mehmet Ozhaseki, ran for mayor under the banner of Mr Erdogan and his nationalist allies.
The ruling party accused his opponent Mr Yavas of forgery and tax evasion. Mr Yavas said he was the victim of a smear campaign.
Another closely watched mayoral election was in Istanbul, Turkey’s largest city.
Mr Erdogan began his rise to power as its mayor in 1994 and said at campaign rallies that “whoever wins Istanbul, wins Turkey”.
Mr Erdogan named former prime minister Binali Yildirim to run against opposition candidate Ekrem Imamoglu in the Istanbul mayor’s race.
Before the elections, Mr Erdogan campaigned tirelessly for AKP’s candidates, framing the municipal elections taking place across Turkey as matters of “national survival”.
He also portrayed the country’s economic woes as attacks by enemies at home and abroad.
Since the previous local elections in 2014, Turkish citizens have gone to the polls in five different elections.
In last year’s presidential and parliamentary elections, Mr Erdogan garnered 52.6% of the votes and his party and its nationalist ally won 53.7% of the parliamentary vote.