Poland's Senate on July 22 defied the European Union and approved legislation giving political leaders substantial control over the judiciary.
The bill sponsored by the nation's populist ruling party now needs only the signature of President Andrzej Duda to become law. Duda has adhered to the ruling party line up to now.
The 55-23 vote was booed by protesters gathered in front of the Senate building in Warsaw.
EU leaders have criticized the bill for impairing judicial independence and threatening the rule of law. Poland is the largest of the former Soviet bloc states who joined the union after the fall of communism.
Jaroslaw Kaczynski, head of the ruling Law and Justice party, argues that the judiciary still functions as it did during the communist era and harbors many judges from that time. Communist rule ended in 1989.
He says the justice system needs "radical changes."
The legislation calls for firing current Supreme Court judges, except those approved by the president, and it gives the president power to regulate the courts.
Prime Minister Beata Szydlo has dismissed the EU criticisms, saying the legislation is an internal matter and the government will not bow to any foreign pressure.
Based on reporting by AP and Reuters