Turkey’s state-run news agency says the country’s highest electoral body has ruled for a rerun of the Istanbul mayoral election after President Recep Tayyip Erdogan’s party challenged the legitimacy of the vote an opposition candidate narrowly won.

Anadolu Agency said the Supreme Electoral Board on Monday ruled in favor of Erdogan’s conservative and Islamic-based party and annulled the results of the March 31 local election in Istanbul. It was not immediately clear when the election would be repeated.

In a major setback to Erdogan’s 16-year rule, the opposition took control of local governments in the capital of Ankara and Istanbul, ending the ruling party’s decades-long control of both cities.

Erdogan’s party challenged the results in Istanbul, maintaining that alleged irregularities had affected the outcome.