BUCHAREST (Reuters) - Romania’s lower house of parliament, which is dominated by the ruling Social Democrats, approved a bill on Monday that will change the way magistrates are supervised and which critics say threatens judicial independence and efforts to fight corruption.

Thousands of Romanians have rallied in the capital Bucharest and other cities over the past weeks protesting against government plans to overhaul the judicial system in one of European Union’s most graft-prone member states.

Lawmakers approved the bill by 179 votes to 90 vote. Parliament has been debating the legislation, which the European Commission and thousands of magistrates have said would put the judicial system under political control, since mid-November.

The parliamentary commission which has debated the changes is headed former justice minister Florin Iordache, who quit in February after a decree on graft that he drafted triggered the biggest rallies since the 1989 anti-communist revolution.

Contested elements of the bill include changes to a judicial inspection unit which oversees the conduct of magistrates. It will also change the way in which chief prosecutors are appointed and strip the president of the right to vet candidates, as well as amending the definition of prosecutors’ activity to exclude the word “independent”.

“Prosecutors carry out their work according to the principles of legality, impartiality, hierarchical control, under the authority of justice minister,” reads the bill.

The bill also refers to the finance ministry’s obligation to recoup any losses triggered by a judicial error from the judge who issued the sentence, instead of from state funds. Experts have said this would could potentially distort court judgments.

The bill will be sent to the upper house, the senate, for debates. A vote in the senate, which has the final say on the bill, could be scheduled for later this month.

Transparency International ranks Romania among the European Union’s most corrupt states and Brussels keeps Romania’s justice system under special monitoring.

In a Nov. 15 report the European Commission said justice reform has stagnated this year and challenges to judicial independence remain a persistent source of concern.