Turkish authorities have scrapped the result of a vote for Istanbul mayor that was lost by the candidate backed by the president, Recep Tayyip Erdoğan, in response to calls by his AK party for a rerun.

In a move that hit the lira and drew opposition accusations of “dictatorship“, the high election board (YSK) ruled that a fresh Istanbul mayoral contest must be held on 23 June.

The AK party representative at the board, Recep Özel, said the decision was based on unsigned results documents from the 31 March poll and the fact that some ballot box officials were not civil servants.

Turkey’s main opposition, the Republican People’s party (CHP), whose candidate Ekrem İmamoğlu narrowly won the mayor’s office in the country’s largest city, called the ruling a “plain dictatorship.

He said it was a “treacherous decision” and vowed to fight on. “They are trying to take back the election we won. Maybe you are upset but never lose your hope,” he told thousands of supporters in central Istanbul following the ruling.

Kati Piri, the European parliament’s Turkey rapporteur, said the decision “ends the credibility of democratic transition of power through elections” in the country.

Reuters witnesses said people were banging on pots and pans in protest in several Istanbul districts.

The AKP appealed for the rerun after initial results and a series of recounts showed it had lost control of Istanbul for the first time in 25 years. It was a shock defeat for Erdoğan, who served as the city’s mayor in the 1990s and campaigned hard before the vote, his first electoral test since last year’s sharp currency crisis tipped the Turkish economy into recession.

The Turkish lira weakened and was at 6.1075 against the dollar at 1730 GMT, on track for its worst day in more than a month. The currency has tumbled more than 10% since a week before the initial election. Suspense over the ruling had left investors worried that weeks of additional campaigning would divert funds and attention from addressing economic reforms.

“This is damaging for Turkey’s perception as a democracy and will leave Turkey’s economy vulnerable, given risks to macro financial stability in the period to July,” said Timothy Ash of Blue Bay Asset Management.

One CHP member of parliament, Mehmet Bekaroğlu, said on Arti TV that the AKP pressurised and threatened YSK judges with prison if they voted against a rerun.

“It is illegal to win against the AK party,” the CHP deputy chair, Onursal Adıgüzel, said on Twitter. “This system that overrules the will of the people and disregards the law is neither democratic, nor legitimate.”

In the capital Ankara – where the AKP also lost the mayor’s office to the CHP – police blocked the entrance to the YSK’s headquarters on Monday evening.

With its nationalist MHP allies, the AKP wanted the Istanbul results annulled and cited irregularities that affected the outcome, which, it claimed, gave about 13,000 votes to CHP. On Saturday, Erdoğan said “it’s clear” the vote was marred by controversy and urged the YSK to “clear its name” with a rerun.

İmamoğlu officially took office last month. Since then, prosecutors have started investigations into alleged irregularities and called 100 polling station workers in for questioning as suspects.