Polish politicians have overwhelmingly approved two bills that would give the ruling party greater power over the judiciary despite blunt warnings from elsewhere in Europe that the legislation contravenes democratic norms.
Supporters in the conservative Law and Justice party said the changes would make Poland's courts more efficient and more accountable to regular citizens by giving elected representatives a role in choosing judges.
Opponents said the ruling party, led by powerful leader Jaroslaw Kaczynski, was violating international law and Poland's constitution by infringing on judicial independence and the separation of powers principle.
Opposition politicians in a country that threw off decades of communist rule 28 years ago chanted "Dictatorship!" before and after the votes in the Sejm, the lower house of Poland's parliament.
Grzegorz Schetyna, head of the opposition centrist party Civic Platform, called it a "black day" for Poland's judicial system.
Borys Budka, a former Polish justice minister who also belongs to Civic Platform, predicted the laws would not bring about real reforms, just "party-controlled courts".
The laws change the functioning of the nation's Supreme Court and the process for naming the National Council of the Judiciary, a body that nominates judges.
Politicians voted 239-171, with 24 abstentions, to pass the law on the Supreme Court, which confirms election results as well as serving as court of last appeal in Poland.
They voted 237-166, with 22 abstentions, to approve the law on the judicial council.
Earlier versions were vetoed in July by President Andrzej Duda following mass street protests and condemnation from the European Union, which said the changes would undermine the independence of the judicial branch of government.
Law and Justice says it has a democratic mandate to reform the judicial system, which it claims was never properly purged after communism fell and which it describes as deeply corrupt and inefficient.
The bill relating to the Supreme Court would lower the mandatory retirement age for justices from 70 to 65.
That requirement would force dozens of the 87 sitting justices to step down unless they obtain individual suspensions of the requirement from Poland's president.
The new Supreme Court would also have the power to review and overturn verdicts from courts at all levels going back 20 years based on citizen complaints.
A provision allowing prosecutors and untrained assessors to rule in judicial discipline cases has also drawn criticism.
The proposed law on the National Council of the Judiciary would give politicians the right to choose 15 out of the council's 25 judges, who so far have been selected by other judges.
Candidates would be suggested by groups of citizens or judges, and confirmed by politicians in parliament.
Critics say judicial independence in Poland had already been compromised in the two years of Law and Justice rule, but that today's bills would complete what they see as a takeover of the courts and the death knell for Poland's democracy.
The Venice Commission, a board of legal experts with Europe's top human rights body, the Council of Europe, said the changes constituted a "grave threat" to the judiciary.
After winning the 2015 election, the government led by the populist party quickly took control of the Constitutional Tribunal, essentially removing a potential check on its legislation by weakening the panel that reviews laws for constitutionality.
In July, it gave the prosecutor general authority to name the heads of all ordinary courts.
The developments in parliament today came a day after Law and Justice said finance minister Mateusz Morawiecki will replace Prime Minister Beata Szydlo.
Some critics interpreted the political shake-up as an effort to distract people from the passage of the laws.