Turkey’s top election authority voided the election victory of an opposition candidate and ordered a rerun of the mayoral election in Istanbul, ruling Monday in favour of the challenge made by President Recep Tayyip Erdogan’s party to the legitimacy of the vote it narrowly lost.

Ekrem Imamoglu of the opposition Republican People’s Party, or CHP, won the mayor’s race in Turkey’s largest city by a slim margin on March 31, defeating the ruling party’s candidate, former prime minister Binali Yildirim.

Erdogan’s conservative and Islamic-based Justice and Development Party, or AKP, alleged election irregularities made the results invalid. It pushed for an annulment of the vote after 17 days of appeals and repeated recounts failed to produce a different outcome.

‘It is illegal to win against the AK’

State-run Anadolu Agency said the Supreme Electoral Board ruled in favour of Erdogan’s party and new elections in Istanbul would be held June 23. Private NTV television reported the board voted 7-4 in favor of voiding the earlier vote.

The opposition has in the past questioned the independence of the electoral body, and members held an emergency meeting Monday night, NTV reported.

“It is illegal to win against the AK Party,” main opposition CHP party Deputy Chairman Onursal Adiguzel said on Twitter. “This system that overrules the will of the people and disregards the law is neither democratic, nor legitimate. This is plain dictatorship.”

Ekrem Imamoglu of the opposition Republican People’s Party’s (CHP) mayoral candidate in Istanbul, is shown in a photo during an Associated Press interview on April 4 on Istanbul. After weeks of uncertainty, Turkey’s highest electoral board made its decision Monday on the vote’s appeal. (Lefteris Pitarakis/Associated Press)

Turkey’s March 31 local elections were a major setback for Erdogan. His party lost city hall in the capital, Ankara, as well as Istanbul, ending a 25-year run in control of both cities by the Justice and Development Party’s the ruling party’s and its Islamist predecessor’s 25-year-old hold on both cities.

“My people tell me the elections should be renewed. I have not spoken until now, I’ve been silent. But everyone else has spoken. Enough already,” Erdogan said. “There is a controversy here, it’s clear. There is an irregularity here, that’s clear too. Let’s go to the people and see what they say and whatever the outcome, we will accept it.”

Erdogan served as Istanbul’s mayor in the mid-1990s.