Istanbul is gearing up for a rerun of March’s mayoral contest this weekend, a vote that could have far-reaching implications for democracy and the rule of law in Turkey.

Turkey’s electoral board upheld a complaint by the ruling Justice and Development party (AKP) over counting irregularities in the 31 March vote, which was won by an opposition candidate, Ekrem İmamoğlu, in one of the biggest challenges to Recep Tayyip Erdoğan’s grip on the country in his 16 years as leader.

Istanbul’s residents have been to the polls 13 times since 2002 in general elections, local elections and referenda, and on Sunday they will go again. “The word election has a new meaning for me now and it is ‘stress’,” said one voter, Pelin Dinar, 36. “We have had so many elections and the way that the result [in March] was cancelled means that our belief in fair elections is fading away each time.”

Both the public and politicians appear exhausted by the new round of campaigning, but the whole country is aware that the stakes on Sunday are high. Losing control of Turkey’s biggest city and economic heart would be an unacceptable outcome for the AKP.

The March result was a personal blow to Erdoğan. The Turkish president was born and raised in Istanbul’s working-class Kasımpaşa neighbourhood and became the city’s first conservative mayor in 1994.

The unprecedented swing of conservative and working-class votes away from the AKP was widely viewed as a rebuke to the president’s handling of Turkey’s economic crisis. The cost of living has been soaring and unemployment stands at 12.7%.

The decision to cancel İmamoğlu’s narrow victory was met with outrage by both the opposition and within some factions of the government itself, who said it dented the ruling party’s democratic credentials. The former president Abdullah Gul and the former prime minister Ahmet Davutoğlu have both openly criticised the AKP for seeking a rerun, fuelling rumours in Turkish media that the senior AKP politicians are preparing to form breakaway parties.

“The rerun decision … definitely made the cracks within the AKP more visible,” Can Selçuki, general manager of the Istanbul Economics Research thinktank, told the Associated Press. “If İmamoğlu wins, it’s likely those cracks will become even more visible.”

The AKP has taken a decidedly different approach to campaigning than last time. In March the campaign was dominated by the president himself. This time Erdoğan has stayed away and the AKP’s mayoral candidate, Binali Yıldırım – a former prime minister and staunch ally of the president – has come up with several new policies designed to appeal to younger voters and the city’s Kurdish population.

In the past few days the president has resurfaced to launch personal attacks on İmamoğlu, accusing him of acting in league with the outlawed Kurdistan Workers’ party (PKK). Despite the AKP’s efforts, however, most polls suggest İmamoğlu’s razor-thin lead of 0.2% over Yıldırım in the March election has since widened.

İmamoğlu has cast the new election as a battle for the future of Turkish democracy. “This is not only a local election, it is a battle for democracy,” İmamoğlu said in a televised debate with Yıldırım last week. “I am an elected mayor who only served for 18 days [before the vote was cancelled]. This is a struggle against those who have seized the democratic rights of 16 million people.”