The winner of the re-rerun of Istanbul's mayoral elections declared a "new beginning for Turkey" on Sunday after the ruling party's candidate lost the city for the first time in 25 years, in a major blow to president Recep Tayyip Erdogan.
"It was not a single group or party, but the whole of Istanbul and Turkey that won this election," said Ekrem Imamoglu, the candidate of the secularist Republican People's Party (CHP), who received 54 per cent of the vote.
President Erdogan had claimed that "whoever wins Istanbul wins Turkey" - and had taken a gamble by forcing a re-run that backfired after Mr Imamoglu not only won but increased his share of the vote by six per cent.
Binali Yildirim, the Erdogan loyalist standing for the ruling AKP gave a de facto concession speech shortly after the first results were announced.
"I congratulate him and wish him all the luck. My wish is for Imamoglu to serve Istanbul well," he said.
Mr Imamoglu had won the original mayoral election on March 31 by a narrow margin that prompted the AKP to demand a re-run, citing alleged voting irregularities.
The High Election Board's decision to grant that request drew criticism from Turkey's Western allies and from Mr Erdogan's opponents at home, stirring concerns about the rule of law and raising the stakes in a re-run that many Turks saw as a test of their country's democracy.
Mr Erdogan was Istanbul's mayor in the 1990s before he embarked on a national political career, dominating Turkish politics first as prime minister, then as president.
He presided over years of strong economic growth but critics say he has become increasingly authoritarian and intolerant of dissent. If confirmed, this second defeat in Istanbul, Turkey's biggest city and commercial hub, will be a major embarrassment for the president and could also weaken what until recently seemed to be his iron grip on power.
Analysts say the loss could set off a cabinet reshuffle in Ankara and adjustments to foreign policy. Turkey is balancing diplomatic relations with Russia and the United States, which has threatened sanctions against its NATO ally over its purchase of Russian missile defences.
The setback for Erdogan, who campaigned hard in Istanbul, could also trigger a national election earlier than 2023 as scheduled. Turkey's economy is now in recession and the United States, its Nato ally, has threatened sanctions if Mr Erdogan goes ahead with plans to install Russian missile defences.
The uncertainty over the fate of Istanbul, Turkey's business hub, and potential delays in broader economic reforms, have kept financial markets on edge. Turkey's lira currency tumbled after the decision to annul the March vote and is down nearly 10 per cent this year in part on election jitters.
Polling stations across Istanbul opened at 8am, with 10.56 million people registered to vote in a city which makes up nearly a fifth of Turkey's 82 million population. One voter, Estate agent Bayram, 60, said he voted for Mr Yildirim, as he believed foreign powers the United States, Europe and Israel supported the opposition. "All of these will want a piece from Istanbul and then there will be chaos.
The enemy of my enemy is my friend. All these foreign powers don't like Erdogan, so he is my friend," he said after voting in Kagithane district, an AKP stronghold.