WARSAW, Poland -- Polish democracy icon and former president Lech Walesa on Saturday joined the protests that have broken out across Poland over plans by the populist ruling party to put the Supreme Court and the rest of the judicial system under the party's political control.

The European Union and many international legal experts say the changes would mark a dramatic reversal for a country hailed as a model of democratic transition over the past quarter century, and move Poland closer toward authoritarianism.

The ruling Law and Justice party defends the changes as reforms to a justice system that party leader Jaroslaw Kaczynski says was never purged of former communists after that system collapsed in 1989. The claim is rejected by critics.

Get Breaking News Delivered to Your Inbox

Walesa addressed protesters in Gdansk, his home city, where he led strikes in the 1980s against the then-communist regime that eventually toppled the government and ushered in democracy.

People gather during a protest against the Supreme Court legislation in Poznan, Poland on July 22, 2017. Agencja Gazeta/Lukasz Cynalewski via Reuters

The 73-year-old Walesa recalled those democratic changes, saying that the separation of powers into the legislative, executive and judicial branches was the most important achievement of his Solidarity movement.

"You must use all means to take back what we achieved for you," he told a crowd that included young Poles. The 1983 Nobel Peace Prize winner also said he would always support their struggle, words that appeared to rule out any leadership role for him in the protests.

Later Saturday night, crowds of thousands began to form in Warsaw, Krakow and other Polish cities. Some people held up placards with the word "Constitution" - a reference to accusations the governing party is destroying Poland's constitutional order.

In Warsaw, 29-year-old lawyer Marzena Wojtczak disputed the ruling party's claim that the judicial system was filled with former communists, saying many judges had been anti-communist dissidents and others are too young for that era.

Another protester, Tadeusz Przybylski, 61, said he opposed the communists decades ago and was back now because the ruling party's moves to control the judiciary have led to a "lack of democracy and justice."

Three bills changing the rules for the Supreme Court and other judicial bodies have been approved by Polish lawmakers but they must still be signed into law by President Andrzej Duda. The protesters, bearing signs "3 X veto," urged him to block the legislation.

The Supreme Court has, among other powers, jurisdiction over the validity of elections. Government critics fear the ruling party could abuse its new power and falsify future elections.

Editor-in-chief of Newsweek Polska, Tomasz Lis, an outspoken government critic, said on Twitter that it was the "worst and the best moment in time for Poland since 1989. A great nation is defending democracy and its own freedom. Bravo."

Other protesters gathered in front of Kaczynski's house chanting "we will bring down the dictatorship!"

After the populist Law and Justice party won power in 2015, it took on the country's system of checks and balances as it sought to cement its power, often passing contentious laws in the middle of the night and without any public consultation. Those steps have led to repeated street demonstrations.

The party has turned public media into its mouthpiece, purged the army of most of its leadership and has already neutralized the power of the Constitutional Tribunal to block any new legislation that might violate the constitution.

On Saturday, presidential spokesman Krzysztof Lapinski said Duda sees some flaws in the legislation on the Supreme Court. But he stopped short of saying whether the president would reject the bill or seek the opinion of the Constitutional Tribunal.

Duda has 21 days to sign the bill into law.

Although the European Commission has expressed its concerns about Poland's judicial changes and recently threatened to strip Poland of its EU voting rights, it has so far been powerless to do anything. Any sanctions would require unanimity of the remaining 27 EU members.

On Saturday, Hungarian Prime Minister Viktor Orban said his country will use all available legal means to protect Poland from what he called the EU's "inquisition campaign."