WARSAW (Reuters) - Tens of thousands of Poles protested on Thursday against a new law that allows parliament to appoint Supreme Court judges, defying a European Union warning that the move undermines democracy and the rule of law.

The bill, sponsored by the ruling Law and Justice party (PiS), was passed by parliament’s lower house earlier in the day after tumultuous debate. That triggered one of the biggest protests since the PiS came to power in late 2015.

The vote came a day after the EU gave its largest formerly communist member state a week to shelve judicial reforms that Brussels says would put courts under direct government control.

If Warsaw’s nationalist-minded PiS does not back down, the government could face fines and even a suspension of voting rights, although other euroskeptics in the EU, notably Hungary, will likely veto strict punishment.

In the best-case scenario, Poland will see its clout in Brussels wane further, damaged by mounting frustration among its EU peers arising from bitter disputes over issues such as migrant quotas and nature conservation.

“We will ... not allow them to trample European values,” Wladyslaw Kosiniak-Kamysz, leader of the Polish People’s Party (PSL), told a crowd in Warsaw. “We will not allow ourselves to be pushed out of the European Union.”

A crowd in front of the Presidential Palace, carrying Polish and EU flags responded by chanting, “Free Poland, European!” “Free Poland, European!”

Sources close to the Presidential Palace told Reuters that President Andrzej Duda was on vacation on the Baltic seacoast.

Warsaw City Hall estimated the crowd at more than 50,000, while police put it at 14,000. Tens of thousands demonstrated in other Polish cities.

“I wanted to be here on this historic day when our freedoms for which we fought for more than 25 years are being taken away,” said Piotr, 48, who came to the protests in Warsaw with his 5-year-old son.

The government says the changes are needed to make courts accountable and to ensure state institutions serve all Poles, not just the “elites” it says are the support base for the centrist opposition.

PiS has offered no concessions, instead presenting the criticism as unacceptable foreign meddling in the domestic affairs of the country, which overthrew communism in 1989 and joined the EU in 2004.

“We will not give into pressure,” Prime Minister Beata Szydlo said on Thursday evening in a special state television address defending the bill. “We will not be intimidated by Polish and foreign defenders of the interests of the elite.”

Slideshow ( 13 images )

STANDARDS AND VALUES

The bill will go to parliament’s upper house on Friday, where PiS has an absolute majority. Duda, a PiS ally, will have to sign it before it can become law.

Critics at home and abroad say the legislation is part of a drift towards authoritarianism by the government, which espouses nationalist rhetoric coupled with left-leaning economic policy.

Slideshow ( 13 images )

“We are concerned about (the) Polish government’s continued pursuit of legislation that appears to limit the judiciary and potentially weaken the rule of law in Poland,” U.S. State Department spokeswoman Heather Nauert told reporters in Washington, according to an official transcript.

“We continue to watch that situation very carefully. We continue to have conversations at the highest level with the government of Poland and express our concerns about that,” she added.

Since being elected in 2015, PiS has tightened government control over courts and prosecutors, as well as state media, and introduced restrictions on public gatherings and the activity of non-governmental organizations.

Last week, parliament passed another bill that ends the terms of current members of the National Council of the Judiciary, one of the main judicial bodies, and gives parliament powers to choose 15 of its 25 members.

Political opponents, rights groups and the EU say the changes undermine the separation of powers between the executive and the judiciary, a fundamental democratic principle.

While PiS remains broadly popular among many Poles, particularly poorer and older voters from the countryside, there have been widespread protests against the plans.

European Council President Donald Tusk, a former Polish centrist prime minister and arch-adversary of PiS, said on Thursday he had asked Duda for an urgent meeting about the “political crisis” in the country.

Tusk said in a statement that PiS moves on courts were backward, went “against European standards and values”, harmed Poland’s reputation and risked marginalizing the country.

“The European Union is not only money and procedures. It is first and foremost values and high standards of public life. That is why a wave of criticism of the government is rising in Europe and in the whole West,” Tusk said.

A senior aide to Duda, Krzysztof Szczerski, said Tusk should instead focus on explaining Poland’s stance in Brussels.

“The president is surprised that there has been such increased engagement in this matter by European institutions because everything is in accordance with the Polish legal order,” Szczerski told Reuters in an emailed statement.

The bill passed on Thursday calls for replacing all Supreme Court judges except those elected by a judicial panel that is to be chosen by the parliament. The Supreme Court’s tasks include validating elections.