Opposition candidate Ekrem İmamoğlu of the secularist Republican People's Party (CHP) secured 54.21% of votes, winning control of Istanbul in a re-run mayoral election, the head of the High Election Board announced on Monday.
The election win dealt a stinging blow President Tayyip Erdoğan, breaking his aura of invincibility and delivering a message from voters unhappy over his ever tighter grip on power.
The previous result was annulled after protests from Erdoğan's Islamist-rooted AK Party, which said there had been widespread voting irregularities. The decision to re-run the vote was criticized by Western allies and caused uproar among domestic opponents who said Turkey's democracy was under threat.
On Sunday and in the early hours Monday, tens of thousands of İmamoğlu supporters celebrated in the streets of Istanbul after the former businessman triumphed over Erdoğan's handpicked candidate by almost 800,000 votes.
"In this city today, you have fixed democracy. Thank you Istanbul," İmamoğlu told supporters who made heart signs with their hands, in an expression of the inclusive election rhetoric that has been the hallmark of his campaigning.
"We came to embrace everyone," he said. "We will build democracy in this city, we will build justice. In this beautiful city, I promise, we will build the future."
Erdoğan congratulated him for the victory and İmamoğlu's rival, Binali Yildirim of the ruling AK Party (AKP), wished him luck as mayor barely two hours after polls closed.
Erdoğan has ruled Turkey since 2003, first as prime minister and then as president, becoming the country's most dominant politician since its founder, Mustafa Kemal Ataturk, nearly a century ago.
His AKP has strong support among pious and conservative Turks and its stewardship of Turkey's economy through a decade and a half of construction-fuelled growth helped Erdoğan win more than a dozen national and local elections.
But economic recession and a financial crisis have eroded that support and Erdoğan's ever-tighter control over government has alarmed some voters.
Turkey's lira tumbled after the decision to annul the March vote and is down 8% this year, in part on election jitters.
But assets rallied on Monday as investors welcomed the removal of one source of political uncertainty. The lira firmed 1% against the dollar, shares rose nearly 2% and bond yields fell.
İmamoğlu won support even in traditionally pious Istanbul districts, once known as AK Party strongholds, ending the 25-year-long Islamist rule in the country's largest city.
"This re-run (election) was one to put an end to the dictatorship," said Gulcan Demirkaya, a 48-year-old housewife in Istanbul's AKP-leaning Kagithane district. "God willing, I would like to see him as the president in five years' time. The one-man rule should come to an end."
Fallout in Ankara
The results are likely to trigger a new chapter in Turkish politics, now that the country's top three cities now held by the opposition. Cracks could also emerge within Erdoğan's AKP, bringing the economic troubles more to the fore.
"This is definitely going to have an impact on the future of Turkish politics given the margin of victory. It's alarming sign for the AKP establishment," said Sinan Ulgen, visiting scholar at Carnegie Europe in Brussels and former Turkish diplomat.
Analysts say the loss could set off a cabinet reshuffle in Ankara and adjustments to foreign policy. The leader of the AKP's nationalist ally played down the prospect that the loss could even trigger a national election earlier 2023, when the next polls are scheduled.
"The election process should close," MHP party leader Devlet Bahceli said. "Talking of an early election would be among the worst things that can be done to our country."
The uncertainty over the fate of Istanbul and potential delays in broader economic reforms have kept financial markets on edge. Threats of sanctions by the United States if Erdoğan goes ahead with plans to install Russian missile defenses have also weighed on the markets.
A Council of Europe delegation said its observers were given a "less than friendly reception" in some places and had "too many unnecessarily aggressive and argumentative encounters to ignore," but that the election was conducted competently.
"The citizens of Istanbul elected a new mayor in a well-organized and transparent vote, albeit in tense circumstances," delegation head Andrew Dawson said in a statement.
By Humeyra Pamuk and Jonathan Spicer/Reuters
Reporting by Humeyra Pamuk and Jonathan Spicer; Additional reporting by Ezgi Erkoyun, Ali Kucukgocmen and Daren Butler; Writing by Dominic Evans; Editing by Jon Boyle.