Istanbul, Turkey – In a major blow to Turkish President Recep Tayyip Erdogan, the opposition Republican People’s Party (CHP) candidate Ekrem Imamoglu has declared victory in the rerun of Istanbul’s mayoral election, after initial results showed he was set for a clear win.

Imamoglu had won 54 percent of votes with almost all of the ballot boxes opened on Sunday, with the ruling Justice and Development Party’s (AK Party) candidate trailing on 45 percent and conceding defeat.

According to Aljazeera,  Imamoglu promised a “new beginning” for Turkey‘s largest city and commercial hub.

“You have protected the reputation of democracy in Turkey,” he told supporters.

His opponent, former Turkish Prime Minister Binali Yildirim, conceded defeat after initial results showed he was set to lose by a decisive margin.

Supporters of Ekrem Imamoglu celebrate in Istanbul © Reuters

“According to the result as of now, my competitor Ekrem Imamoglu is leading the race. I congratulate him and wish him good luck,” Yildirim said.

CHP’s win ends the AK Party’s 17-year rule in the metropolis.

The Istanbul mayoral election was first held on March 31, when Imamoglu secured 48.8 percent of the vote, while the AK Party’s Yildirim held 48.55 percent, making Imamoglu mayor with a razor-thin margin.

The AK Party proceeded to file an “extraordinary objection” to the results, leading the Supreme Electoral Council (YSK) to annul the results and schedule Sunday’s rerun.

Not just a local election

The Istanbul election is far bigger than any local vote, as the rerun put into question the country’s democracy and threatened the AK Party’s grip on power over the last two decades.

Turkey’s President Recep Tayyip Erdogan – who served as Istanbul’s mayor in the 1990s and leads the AK Party – has famously said: “Whoever loses Istanbul loses Turkey”.

Erdogan cast his vote on Sunday amid high security in Uskudar, a predominately conservative district on the city’s Asian side.

Berk Esen, Bilkent University assistant professor of international relations, described it as being a “major personal blow for Erdogan.

“It has marked the beginning of the end for the Turkish-style presidency and become difficult for the AKP machine to sustain itself,” he said.

Senior AK Party member Harun Armagan downplayed the significance of the defeat.

“[This election loss] doesn’t mean more than in any other city. Obviously, Istanbul is very important, but at the same time, AKP have won more municipalities than any other parties combined in this election,” Armagan said, referring to the original March 31 vote.

He went on to say the AK Party would now take its time to assess where they have fallen short on reaching their previous supporters in Istanbul.

“This is democracy, we have to expect the rule of people.”

After casting his vote earlier on Sunday, AK Party candidate Yildirim addressed a gathered crowd with a statement seemingly pointing to the pressure felt by his party.

“If we ever did any wrong to any rival or brother in Istanbul, I would like to ask for their forgiveness and blessing,” he said.

Countering irregularities

To ensure no “illegal wrongdoings” were made in Istanbul’s mayoral rerun, various independent mechanisms have been implemented to monitor the voting and counting process.

For example, responding to a call by the CHP, lawyers from across Turkey volunteered their time to travel to Istanbul to act as observers and counter election fraud.

One lawyer was appointed to each voting booth set up in nearly 2,000 polling stations across the city.

Esen told Al Jazeera it was an important development for Turkish politics, as the vote counting process has not been very accurate and fair in previous elections.

It’s important for the opposition party to organise and mobilise supporters not only to come out and vote but also observe the counting process to make sure no votes will be stolen,” Esen said.

“Lawyers … would be able to make sure that the ruling party will not be able to cancel the result on a mere technicality.”

In 2014, state-run Anadolu news agency was designated as the outlet providing live election results to the media, a move that spurred the voluntary Vote and Beyond (“Oy ve Otesi”) organisation to begin working to ensure “transparent and accountable elections”.

To counter possible abuse of this exclusivity – during the March 31 election, Anadolu stopped broadcasting at 11pm when Imamoglu took the lead – Vote and Beyond launched a mobile application to post live updates.

The data is sourced from volunteers at each polling station recording “minutes” of the counts.

A group of citizen journalists who founded the group Dokuz8, also in 2014, have also released live updates of the vote counting.

: