BUCHAREST (Reuters) - Seven European Union states urged Romania’s ruling coalition on Thursday to avoid legislation that could weaken its judiciary and the fight against corruption, hours after senators approved a contentious overhaul of the justice system.

Senators passed the last of three bills which critics say limit the independence of magistrates and which have triggered street protests across Romania, widely regarded as one of the EU’s most corrupt states.

The three bills change the process of appointing chief prosecutors and set up a special unit to probe crimes committed by magistrates, making them the only professional category with a prosecuting unit dedicated to investigating them.

France, Germany, the Netherlands, Belgium, Denmark, Finland, and Sweden said in a joint statement from their embassies in Bucharest that the bills and criminal code changes under debate in parliament undermined Romania’s progress on judicial reforms.

“We appeal to the parties involved in the justice reform project to avoid any action that could lead to weakening the independence of the justice system and of the fight against corruption,” the joint statement said.

The seven states joined a chorus of criticism that included the European Commission, the U.S. State Department, thousands of Romanian magistrates and centrist President Klaus Iohannis.

Romania’s ruling Social Democrats, which command an overwhelming majority in parliament together with their junior coalition partner, ALDE, have so far ignored the warnings.

They are also working on changes to the criminal code that critics say will derail law and order.

Opposition politicians challenged the bills in the Constitutional Court on Thursday. Romania’s top court also said it will challenge legal changes to the status of magistrates.

It was unclear when the court would meet to rule on the challenges but it could be months before the bills are enforced, as the president must also sign off on them. Iohannis has repeatedly criticized the bills.

The proposed changes place Romania alongside its eastern European peers Hungary and Poland, where populist leaders are also trying to control the judiciary, in defying EU concerns over the rule of law.

The Commission launched an unprecedented action on Poland on Wednesday, calling on other member states to prepare to sanction Warsaw if it fails to reverse judicial reforms it says pose a threat to democracy.