Istanbul, Turkey (CNN) Turkey's election board has ruled in favor of a revote for Istanbul's new mayor -- just weeks after the opposition candidate won the contest -- in a decision denounced by opposition leaders as "plain dictatorship."

The country's Supreme Election Council (YSK) announced its 7-4 decision on Monday due to allegations of electoral fraud, after Turkish President Recep Tayyip Erdogan's party lost the race by a razor-thin margin.

The opposition Republican People's Party (CHP) won control of both Istanbul and capital city Ankara in the March 31 local elections, dealing a blow to Erdogan's Justice and Development Party, known as AKP. But in Istanbul, the victory was a narrow one, with CHP at 48.79% of the vote -- just ahead of AKP's 48.51%

Monday's ruling was denounced by Turkey's opposition. "It is illegal to win against the [AKP] Party," CHP's Deputy Chairman Onursal Adiguzel said on Twitter, according to Reuters.

"This system that overrules the will of the people and disregards the law is neither democratic, nor legitimate. This is plain dictatorship."

Blow to Erdogan

The ruling AKP had appealed to the board in April to annul the result in Istanbul and hold a re-vote, after raising questions about potential voter fraud

Claiming "organized irregularities," AKP Deputy Chairman Ali İhsan Yavuz said there was "only one body to clear the questions. It is Supreme Election Council. Their decisions are binding for all of us."

Reuters reports that the YSK had already ordered partial and full recounts across Istanbul. Imamoglu took office in April as the recounts were completed.

Before March's vote, the AKP and its predecessor have consistently won in Istanbul's local elections since the 1990s, when Erdogan launched his political career there as mayor.

Erdogan served as the face of AKP's local election campaigns this year, and the elections were widely seen as a referendum on his government.