Thousands of Poles demonstrated in the streets on Thursday as President Andrzej Duda signed judicial reform legislation into law that has been criticized within Poland and internationally for enabling the ruling government to effectively take control of the country's Supreme Court.

Crowds gathered in Warsaw outside the Presidential Palace, as well as in town dozens other cities and towns, singing the Polish national anthem and chanting "shame" and "Free courts!"

Many protestors also held up candles and pens, a reference to Duda's readiness to sign the bill.

Reuters news agency reported that a scuffle broke out between protestors and the police in Warsaw and that pepper spray was used.

In Krakow, protestors shouted, "Europe, don't give up."

A demonstration was also scheduled to take place Thursday evening in front of the Polish consulate in New York City. The gatherings were part of the "Chain of Lights" protests that have been ongoing over the past year as Poland's government has pushed through a series of judicial reforms.

Read more: Poland: Peaceful protest 'under serious threat,' warns rights group

Forced retirement for judges

The law, which had been introduced by the ruling right-wing Law and Justice (PiS) party, was approved by the upper house of parliament earlier this week.

It makes it easier to choose the Supreme Court's chief justice and comes after the PiS cut short the term of 22 justices including the current chief justice, Malgorzata Gersdorf, by lowering the retirement age. She has refused to leave her post, which she says constitutionally expires in 2020.

"The constitution guarantees me this venerable post for six years, and I see no reason why I should file a petition with the executive branch about it," Gersdorf told DW earlier in July.

The EU, opposition parties in Poland and human rights group say the law undermines judicial independence and democracy, but the PiS jusitified the law and other judicial reforms by arguing they will make the courts more efficient and rid the judicial system of remaining communist influences.

"Without (judiciary) reforms, we cannot rebuild the Polish state so that it serves its citizens," Jaroslaw Kaczynski, the leader of the PiS, said.

Read more: Poland's Jaroslaw Kaczynski renews call for German WWII reparations

Since the PiS entered the government in 2015, dozens of justices have been dismissed from the Constitutional Tribunal, the National Judiciary Council, which decides judicial appointments, and now the Supreme Court.

The EU has opened legal procedures against Poland over the country's judicial reform initiatives.

Read more: European Court of Justice rules Polish arrest warrants can be halted

cmb/bw (AP, Reuters, AFP)