Poland has approved a controversial law which makes it easier to dismiss judges critical of the governing party's judicial reforms.
The legislation passed by 233 votes to 205 in the lower house of parliament in Warsaw on Friday.
It came just hours after the European Commission urged Poland to reconsider the proposed changes.
Demonstrators rallied in their thousands across Poland earlier this month to protest against the law.
On Wednesday, the country's Supreme Court warned that Poland could be forced to leave the EU over its reforms.
The law now goes to the Senate after passing on Friday. The upper chamber cannot block the legislation, though it can delay it.
Under the legislation, championed by the socially conservative Law and Justice (PiS) party government, judges can be punished for engaging in "political activity".
Any judge that questions the legitimacy of other judges nominated by the National Council of the Judiciary might be handed a fine, have their salaries cut, or in some cases be dismissed.
The PiS changed the law in 2018 allowing the lower house of parliament - which it controls - to choose the members of that council.
PiS alleges that Poland needs the reforms to tackle corruption and make the judicial system more efficient, arguing it is still haunted by the communist era. The party also insists that other EU countries allow politicians to take part in selecting judges.
But critics fear it has curtailed the independence of the judiciary in Poland. The EU has accused the party of politicising the judiciary since it came to power in 2015.
Earlier on Friday, European Commission Vice-President Vera Jourova wrote to Poland's president, prime minister and parliamentary speakers, calling on them to consult legal experts before proceeding with the law change, and asking them not to break EU legal norms.
And a spokesman for the UN High Commissioner for Human Rights said the law "risks further undermining the already heavily challenged independence of the judiciary in Poland".
BBC
More about: Poland