BUCHAREST (Reuters) - Thousands of Romanians protested outside government headquarters in the capital Bucharest on Saturday against the ruling Social Democrats and their attempts to weaken the independence of the judiciary.

The Social Democrats and their coalition partner ALDE used their majority to push a judicial overhaul through parliament in December, despite criticism from the European Commission, the United States, thousands of magistrates and centrist President Klaus Iohannis.

The move is currently being challenged at the Constitutional Court and has yet to become law.

An estimated 5,000 people gathered in Bucharest chanting “Thieves” and demanding the government’s resignation, crowding around a giant European Union flag. Thousands more protested in cities across the country.

“It is humiliating for the Romanian people to be led by politicians who are convicted or under investigation 28 years after the fall of communism,” said Nicu Petrescu, a 56-year-old engineer in Bucharest.

Transparency International ranks Romania among the European Union’s most corrupt states, and Brussels, which keeps the country’s justice system under special monitoring, is especially concerned that the overhaul and the pending changes to the criminal code will reverse graft-fighting progress.

Anti-corruption prosecutors have sent hundreds of lawmakers, ministers, mayors and other public officials across all parties to trial on corruption charges. The speakers of parliament’s lower house and senate and ruling coalition leaders are both currently on trial in separate cases.

Attempts by the ruling coalition to decriminalize several corruption offenses via emergency decree at the start of last year triggered Romania’s largest street protests in decades.

Lawmakers are also debating a new set of proposals to change the criminal code - including decriminalizing some offences and lowering prison sentences.

Opinion surveys have shown that although the Social Democrats have lost some popularity, they would still rank first in an election with just under 40 percent of votes.