"If we stumble in Istanbul, we are losing our footing in Turkey." So said President Recep Tayyip Erdogan back in 2017, in the wake of a referendum that turned Turkey from a parliamentary to a presidential democracy, granting him sweeping powers. On Sunday, Mr Erdogan's fears were realised, when his ruling Justice and Development Party (AKP) was roundly defeated in a rerun of the Istanbul mayoral election.
Mr Erdogan’s decision to force the judiciary to tear up the previous March result and hold the ballot again will go down as a political miscalculation of epic proportions. Ekrem Imamoglu, Istanbul’s new mayor, increased his margin of victory over AKP candidate Binali Yildirim from 13,000 to at least 750,000 votes.
With Turkey’s economy faltering and rising concerns over Mr Erdogan’s authoritarianism, the nation’s people have handed the president a major practical and symbolic defeat, ending a quarter-century of AKP rule of the city. Istanbul – the former Ottoman capital, with deep political and economic significance – is, after all, where Mr Erdogan cut his teeth as mayor. He has repeatedly suggested that Turkey cannot be governed without it.
Mr Imamoglu's victory will fuel talk of Mr Erdogan's political demise. Having enjoyed unfettered control over the city's $4 billion municipal budget, the AKP runs a strong patronage network within Istanbul, which it is now on course to lose. It is worth noting that Mr Erdogan's support base is largely rural, rather than metropolitan. But Istanbul hosts close-knit communities from all over Turkey. If they are voting against Mr Erdogan and the AKP in the city, there is a good chance that this current could exist elsewhere. Lacking the grace to accept legitimate defeat, Mr Erdogan demanded a second chance to retain his party's grip on Istanbul. Now, he stands embarrassed before an entire nation.
As ever with Turkey’s swaggering strongman, the question is not so much how we will act, but how he will react. The AKP was swift to accept defeat on Sunday night, but there are concerns that Mr Erdogan will endeavour to undermine Istanbul’s new mayor, for instance by cutting funding.
Meanwhile, Turkey’s next election is not scheduled until 2023, and it would be misguided to write off the president, who has won 14 straight elections and referendums since the AKP rose to power in 2002. However, he has suffered a stinging blow that will inevitably affect his support.
How Mr Erdogan responds to this most serious of setbacks presents plenty of cause for concern, not least for his opponents. Thousands have been caught up in a string of purges and crackdowns since a failed coup in July 2016. For now, though, many are celebrating the first real evidence of a chink in his armour: the decisive loss of the city where he rose to political prominence.