Poland's parliament moved closer on Tuesday to giving itself the power to appoint Supreme Court judges, ignoring opposition assertions that the move would politicize the judiciary.
Lawmakers from the ruling nationalist Law and Justice (PiS) party and their coalition partners passed the bill in its first reading and moved immediately to the second and final reading, amid frequent opposition cries of "Shame!" and "Cowards!"
Opposition deputies vowed to extend the all-day debate as long as possible to delay the bill's passage into law.
Since winning an election in 2015, PiS has sought to increase the government's influence over courts and prosecutors as well as state media, prompting the European Union to launch a review of the rule of law in one of its newest members.
PiS says the judicial reform is needed to make the courts accountable and ensure that state institutions serve all Poles, not just the "elites" that it portrays as the support base for the opposition.
"PiS ... will carry out this reform to the end," Prime Minister Beata Szydlo told the assembly.
Opposition parties say the bill violates the constitutional separation of powers and could potentially give the ruling party influence over election results through the Supreme Court that validates them — charges that PiS rejects.
President Andrzej Duda, who is backed by PiS and usually supports its legislation, said Poles were "not satisfied with how the justice system functions."
But he threw up a surprise obstacle by saying he would not sign the bill into law unless parliament agreed to increase the majority needed to appoint the panel that would pick future judges.
The bill, which also needs the approval of the upper house, where PiS also has a majority, will retire all the Supreme Court judges unless they get the approval of a judicial appointments panel whose members will mostly be nominated by parliament.
Last Friday, parliament passed a law ending the terms of current members of the panel, the National Council of the Judiciary (KRS), and giving parliament the power to choose 15 of its 25 members.
But Duda on Tuesday insisted that appointments to the KRS should require a three-fifths majority in parliament — a condition that would make it difficult for PiS and its partners to push through appointments to the panel on their own.
Opposition parties say shortening the judges' terms is unconstitutional.
"If the president seriously wanted to stop what's going on, he should veto [all] the bills," said Borys Budka, deputy leader of the main opposition party, Civic Platform (PO).
Several thousand people, many holding candles, gathered in front of the presidential palace in a peaceful protest against the reforms.
The parliament building had been cordoned off with barriers and guards since Sunday, when thousands protested against the Supreme Court legislation in Warsaw and other cities.
The tensions have echoes of a standoff in December when opposition leaders blocked the podium of the debating chamber for a month ahead of a budget vote, after objecting to PiS plans to curb media access to parliament.
The European Commission, the EU's executive, was due to discuss the judicial bills in Brussels on Wednesday, having expressed concerns for months about the direction of reforms in Poland.
The separation of powers between executive and judiciary is a fundamental democratic principle for the EU, but in many member states the effectiveness of separation can be as much a matter of political culture as of formal structures.
The PiS government remains broadly popular, benefiting from record-low unemployment, a robust economy and increased social welfare spending.