BUCHAREST (Reuters) - Romania’s Constitutional Court issued a ruling on Wednesday that could mean many current corruption trials have to restart from scratch, siding with the governing Social Democrats (PSD) in a dispute about how the Supreme Court handles cases of graft.

Romania is one of the European Union’s most corrupt states, and the PSD has been seen as a threat to judicial independence by the EU, the U.S. State Department and thousands of Romanian magistrates since it came to power in 2017.

Prosecutors have secured a spate of convictions against lawmakers, ministers and mayors, including former PSD leader Liviu Dragnea. Their investigations have exposed conflicts of interest, abuse of power, fraud and awarding of state contracts in exchange for bribes.

But the Constitutional Court ruling upheld a challenge by the PSD that argued preliminary corruption trials must be heard by Supreme Court three-judge panels specialized in graft cases, in line with the terms of anti-corruption legislation.

The Supreme Court, which handles most corruption trials involving public officials, has argued that almost no other EU state has specialized panels. However, it started enforcing the rule this January.

The Constitutional Court decision, made by a five to four majority, means that corruption cases that were not finalised by January could be re-tried. It is not clear when its detailed legal argument, which will set out how the ruling should be enforced, will be published.

Since taking power in late 2016, the PSD has chipped away at the independence of the judiciary, prompting criticism from the EU and the largest street protests in decades.

Voters punished the PSD in a May 26 European Parliament election, which the party lost to centrist groupings.

Romanians also overwhelmingly endorsed a non-binding referendum to prevent the government from further changing legislation via emergency decree and from granting pardons and amnesty for graft convictions.

However, the Venice Commission, the advisory body on constitutional matters for the Council of Europe, the continent’s chief human rights watchdog, said the most problematic elements of a judicial overhaul enforced by the Social Democrats either remained unchanged or were aggravated.