Poland’s lower house of Parliament voted 243 to 203 on Thursday night to approve a law meant to end nearly a decade of conflict over who controls the country’s courts, sending the measure to the Senate and setting up a test of whether the president will let it stand.

The bill restores the pre-2018 method of choosing the National Council of the Judiciary, the body that nominates judges, by having its 15 judicial members elected by their fellow judges rather than by Parliament. It also creates a procedure by which the roughly 2,500 judges appointed under the contested system can have their status confirmed by a panel of senior judges, or in some cases be returned to their previous posts.

“This is not revenge, and it is not a purge,” said Jakub Wierzbicki, a deputy justice minister who steered the bill through four committee readings. “It is a repair of a mechanism that the European courts told us, repeatedly and unambiguously, was broken.” The European Court of Human Rights has ruled in a series of cases since 2021 that panels including judges chosen under the 2018 rules did not constitute an independent tribunal, and the E.U. froze billions of euros in recovery funds for several years over the dispute.

Opposition lawmakers said the bill would itself violate the Constitution by subjecting lawfully appointed judges to review. “You cannot cure a procedural dispute by creating a tribunal to judge judges,” said Renata Sobczak, an opposition member of the justice committee, who accused the government of “replacing one political capture with another.”

The practical stakes are considerable. Some 1.1 million cases a year pass through courts where at least one judge’s status is contested, and litigants have increasingly challenged rulings on that basis alone. Marek Zieliński, a district court judge in Warsaw, said his chamber had received 40 such motions this year. “We spend our mornings litigating ourselves,” he said.

The law now goes to the Senate, where the governing coalition holds a majority, and then to the president, who has 21 days to sign it, veto it, or refer it to the Constitutional Tribunal, itself a body whose composition is disputed. A veto can be overridden only with a three-fifths majority in the lower house, which the coalition does not have.

“Everyone in this building knows the arithmetic,” said Agnieszka Ruszkowska, a professor of constitutional law at the University of Warsaw. “The question is whether a law that does not become law can still change behavior. Judges are watching, Brussels is watching, and sometimes a signal is enough to start a thaw.”