Turkey’s top election body has ordered a re-run of the Istanbul mayoral election after President Recep Tayyip Erdogan’s party complained about its shock defeat in the vote, the state news agency reports.

The ruling Justice and Development Party (AKP) narrowly lost Turkey’s biggest city in March 31 local elections, ending the party and its predecessors’ 25-year control of the metropolis.

The AKP claims there were “irregularities and corruption” in the vote that required a re-run of the mayoral election, which was won by Ekrem Imamoglu, of the main opposition Republican People’s Party (CHP) by just 15,000 votes.

Imamoglu received his official mandate after two weeks of recounts, sending shock-waves through the ruling party since Erdogan, former mayor of the city, once said winning Istanbul was like winning the whole of Turkey.

Erdogan had presented the local elections as a matter of national survival. He campaigned heavily, even though he was not running himself.

The AKP still won the most seats nationwide, but anger over the deteriorating economy led it to lose mayorships in both Istanbul and the capital Ankara.

The party did not request a re-run of the election for the Istanbul local assembly, in which it won a majority of seats.

— AFP