For Erdogan, second time was not the charm, and there may not be a third time.

Three months after Turkey's president Recep Tayyip Erdogan and his ruling AKP party suffered a massive blow in Turkey's local elections at the end of March, which resulted in the loss of both Ankara and Istanbul to opposition candidates and which prompted Erdogan to force a revote in the most important Turkish city of Istanbul, Erdogan has suffered another "stunning blow" as Bloomberg put it, after the opposition candidate Ekrem Imamoglu once again won the redo of the Istanbul mayor’s race by a landslide on Sunday, in "a stinging indictment of President Recep Tayyip Erdogan’s economic policies and increasingly autocratic ways".

According to both the state-run Anadolu news agency and Anka Heber news, Imamoglu of the CHP party won 54% of the vote, and the ruling AK Party’s candidate, former Prime Minister Binali Yildirim captured 45%, with more than 95% of ballot boxes opened.

The margin of loss for the AK Party's candidate, Binali Yildirim, grew to nearly 700,000 votes after he lost the March 31 election by a margin of just 14,000 votes. Today's landslide victory for the political upstart telegraphed "undeniably that voters are concerned about the crumbling of Turkey’s democratic foundations and an economy reeling from a spike in consumer prices and unemployment" as Bloomberg puts it.

Istanbul's new mayor, Ekrem Imamoglu

Shortly after the preliminary results were announced and showed Imamoglu's massive victory, Yildirim conceded the election. The big question, whoever, is whether Erdogan will be just as gracious in accepting defeat: last week the president, who had challenged Imamoglu’s win in the original ballot, said that he would accept the outcome of the race but hinted that legal troubles could await the opposition candidate. Losing Istanbul is much more than ceding control of Turkey’s largest city and commercial powerhouse. The Istanbul mayor’s job was the springboard for Erdogan’s own political career, and if Imamoglu acquits himself well in the job, then the president may find himself with a future challenger.

“His performance would determine whether he can become a presidential rival” in June 2023 elections,” Ersin Kalaycioglu, a professor of social sciences at Istanbul-based Sabanci University, told Bloomberg.

In another blow to Erdogan, the defeat in Istanbul, home to a fifth of Turkey’s 82 million people, also strips Erdogan’s party of a major source of patronage and handouts. According to Bloomberg calculations, "the city absorbs a quarter of all public investment and accounts for a third of the country’s $748 billion economy."

The silver lining is that the landslide will make a 2nd revote impossible, and will force Erdogan to accept the outcome. The decisive nature of the win might put investors at ease. A narrow victory would have brought the legitimacy of the vote into question, Anastasia Levashova, a fund manager at Blackfriars Asset Management in London, said before the election. Of course, if Erdogan does not accept the opposition winning Istanbul, then all bets are off. One thing is certain though: Erdogan will never "go quietly into that good night."

So what changed so dramatically between the narrow March outcome and today's landslide?

According to Bloomberg, one thing that may have tipped the scale so heavily in Imamoglu’s favor this time is the shift in sentiment among Kurdish voters.

Some had sat out the original vote, but over the past week, the jailed former leader of the pro-Kurdish HDP party called on his followers to support Imamoglu. “This guy may be the only one to unite opposition parties under one roof in so many years,” said Gizem Konak, 26, who had supported HDP in the past. “I think Imamoglu has the potential to change the destiny of this country.”

Additionally, Imamoglu's popularity surged after election authorities unseated him after just 18 days in office, polls showed. Then, in a last-ditch attempt to crater his reputation, Erdogan did what he has done with virtually every political opponent - alleged that he was backed by enemy forces: the U.S.-based preacher the president accuses of mounting a failed 2016 coup attempt against him, and a party Erdogan sees as the political wing of the autonomy-seeking Kurdish PKK group Turkey’s been battling since the 1980s. In an eerie echo of his own climb to power, Erdogan also called for prosecuting Imamoglu for allegedly insulting a provincial governor. Erodgan himself lost his seat as the mayor of Istanbul after he was imprisoned for four months in 1999 for reciting an Islamic poem deemed a threat to Turkey’s secular order.

In any case, the vote could touch off an early presidential vote to prevent Imamoglu from gaining political traction, Murat Gezici, head of the Gezici polling company, said before the vote. Additionally, an Imamoglu victory could "create political havoc within the ruling AK party, possibly leading to the formation of new political parties and bringing about early elections later this year or early next," Gezici said.

Yet not all is lost for Turkey's executive (and executing) president: even though AK Party has lost Istanbul, Erdogan would have other levers of power to assert his will over the city. The party commands a majority on the municipal council, and together with an ally, leads 25 of Istanbul’s 39 districts.

More than 10 million people were eligible to vote, and the candidates put a priority on getting some of the 1.7 million who didn’t cast ballots in the last round to go to the polls.

With the official fall of Istanbul the fall of Erdogan’s party at the municipal level is complete: it had already lost the capital, Ankara, and some other big cities in the March balloting as inflation, unemployment and a plunge in the lira took their toll. But he refused to concede defeat in Istanbul, crying voter fraud, and Turkey’s top election board concurred.

Oops.

Of course, after the board’s decision in May, the lira weakened the most in emerging markets and stocks were battered as investors fretted over what they saw as the erosion of the rule of law. It remains unclear if the lira will rise or fall on today's outcome, which in turn will depent on What Erdogan does next - does he concede, or does he push for a 3rd vote.

Meanwhile, Turkish economy remains on a downslope. Although unemployment has stabilized, the economy remains in distress, with a double-dip recession threatening. The market craves a break from the never-ending electoral cycle that could finally shift the focus to economic reforms.