Tens of thousands poured into the streets in Poland Thursday night, condemning proposed laws that would dramatically weaken the nation’s judicial system, just two weeks after U.S. President Donald Trump visited the country and praised its commitment to freedom and democracy, speaking to “an audience of close to 15,000 enthusiastic, flag-waving Poles—many of them bused in by Poland’s ruling right-wing” party.

The pending judicial reform is just the latest in a series of anti-democratic measures adopted in Poland since the far-right Law and Justice Party (PiS) came to power in 2015. As the New York Times noted, the party has “increased government control over the news media, cracked down on public gatherings, and restricted the activities of nongovernmental organizations.” It has also limited female reproductive rights.

Now, the party is “moving aggressively to take control of the last major independent government institution, the courts,” the Times noted, by pushing through two measures that would effectively give the party total control over judge selection.

Characterizing the party as “right-wing, EU-skeptic, and nationalist,” Politico explained the party’s two proposed measures:

Last week, parliament adopted a new law revamping the body that appoints judges, the National Council of the Judiciary (KRS), ending the terms of its 15 judges and allowing parliament, where PiS has a narrow majority, to nominate their successors.

The ruling party then moved on to legislation that would immediately retire all the judges on the Supreme Court except those designated by Justice Minister Zbigniew Ziobro, and would lower the requirements for future judges chosen for the court—a step critics say would allow the ruling party to pack the court with its allies. The Supreme Court is Poland’s top court for civil, criminal and military cases; it also confirms election results.

The KRS revamp has been approved by parliament and is awaiting Polish President Andrzej Duda’s signature. Duda formerly belonged to PiS, but as president is considered an independent whose responsibility it is to stand up to PiS party leader Jarosław Kaczyński, who is often considered the country’s de facto leader. However, Duda is often aligned with PiS, and opposition parties lack the power to truly challenge the proposals.

In an unexpected break with his former party, Duda said he would only sign the KRS reform if lawmakers amended the bill so that judges are approved by 60 percent of parliament, rather than a simple majority, as is proposed in the bill’s approved version. PiS is one seat short of a 60 percent majority. Duda also said if parliament doesn’t pass the amendment, he will veto the second bill that would force out the current Supreme Court judges.

Acknowledging Duda’s demands as a “rare disagreement” with Kaczyński and PiS, the Times reported, some are skeptical of the Polish president’s intentions:

Opponents were not sure whether this signaled a true split between the two leaders or was some sort of a trick.

“We don’t know if the president is acting really with some sort of noble intentions or whether he’s just playing a game,” said Mr. Stepien, the former president of the Constitutional Tribunal.

The second bill was approved by the lower chamber of Parliament Thursday—triggering the pro-democracy protests—but still must be approved by the upper house, then signed by Duda, to take effect.