WARSAW — Brushing aside warnings from the European Union and ignoring tens of thousands of protesters in the streets, Poland’s Parliament gave final approval to a landmark measure on Saturday that would restructure the Supreme Court, putting it under effective control of the governing party.

The new law was the latest in a series of acts from the Law and Justice party that critics say are aimed at curtailing the judiciary, the country’s last bastion of independence. If President Andrzej Duda signs the laws, as expected, Poland will take its largest step yet away from the West’s liberal values in a nation that was once a symbol of democracy’s triumph over communism.

After a long day and evening of emotional debate, and protests that migrated across central Warsaw, the Polish Senate approved the new Supreme Court legislation at 2 a.m. by a vote of 55 to 23.

Before the vote, protest leaders called for a rally in the square outside the Supreme Court, the same space where President Trump spoke two weeks ago, praising the government and offering no criticism of the court plan.