In the end it was never even close. Ekrem İmamoğlu was elected mayor of Istanbul yesterday for the second time in three months, taking 54 per cent of the vote, more than double the share of Recep Tayyip Erdoğan when he ascended to the post in 1994.

President Erdoğan, once such an astute political operator, should have sensed early that rerunning the March election was a mistake. After winning a spirited first campaign, and bringing political fresh air to Istanbul for the fortnight he was in office in April, İmamoğlu’s movement only grew as the second ballot approached. His unapologetically upbeat campaign slogan, ‘Herşey çok güzel olacak’ (‘Everything will be OK’), was popular beyond the metropolis. It was reported that people mistakenly showed up to vote as far afield as Diyarbakır, a predominantly Kurdish city in the south-east.

The jailed former leader of the pro-Kurdish Peoples’ Democratic Party (HDP), Selahattin Demirtaş, urged people in Istanbul to vote for İmamoğlu, who sent thanks to ‘our Kurdish brothers and sisters’ in his victory speech last night. For the HDP, long smeared by the government as terrorist sympathisers, such bridge-building is significant. İmamoğlu belongs to Atatürk’s Republican Party (CHP), which suppressed Kurdish culture and autonomy so brutally in the 20th-century formation of the Turkish state, but has seen the other side of state repression under Erdoğan.

İmamoğlu is now the most likely challenger to Erdoğan in the next presidential election, not expected until 2023, the centenary of the Turkish Republic. Born, like Erdoğan, on the Black Sea coast, in the deeply nationalist city of Trabzon, he can speak to working-class Turks in a way the CHP have often failed to. His Pontic Greek origins have been ridiculed by the pro-government and nationalist press, but İmamoğlu could use his family history in the multi-faith, multiracial Ottoman Empire to reclaim the cosmetic ‘Ottomania’ cultivated in recent years by the government. Erdoğan himself knows only too well that to win in Istanbul requires a broad message and strong grassroots organising.

Yesterday’s election seems to have been free of any real foul play. It was held in holiday season, so people cancelled their holidays to vote. Turnout was 84 per cent. The boats that ferry people to tourist destinations on the Dardanelles were put on a reduced service – so people drove the extra hours around the Sea of Marmara to return home and vote. But without serious controversy over recounts or ballot tampering, space has opened up to consider the best political responses to the results. AKP grandees from before the takeover by Erdoğan – Abdullah Gül, Ali Babacan, Ahmet Davutoğlu – will be emboldened in discussions of the need for a new party to replace the cult it has become. In Istanbul, the CHP can prioritise building a movement rather than protesting against election results, and look to dismantling rather than simply inheriting the crony AKP apparatus.