Poland's anti-communist icon Lech Walesa on Monday warned against populism as his deeply divided country marked 40 years since a landmark deal gave rise to the freedom-fighting Solidarity trade union.

Concerns over the strength of Poland's democracy have mounted since 2015 when the right-wing populist Law and Justice (PiS) won office and began introducing controversial reforms, criticised both at home and abroad.

"People today are electing populists and demagogues because they promise change... they (populists) have correctly diagnosed (today's problems) but their cure is wrong," Walesa told hundreds gathered at the historic Gdansk shipyard on the Baltic coast.

Walsea was awarded the Nobel Peace Prize in 1983
Walsea was awarded the Nobel Peace Prize in 1983 AFP / MATEUSZ SLODKOWSKI

It was here on August 31, 1980, that a deal was sealed between the communist regime and striking shipyard workers led by Walesa -- an electrician at the time -- which enabled the creation of Solidarity, the Soviet bloc's first free union.

"We need to take over the initiative from these populists and demagogues and replace it with wiser solutions and better structures," said Walesa, 76.

He then placed flowers on the shipyard gate and symbolically opened it as he did four decades ago after inking the Gdansk Accords.

Hundreds gathered at the historic Gdansk shipyard to mark the anniversary
Hundreds gathered at the historic Gdansk shipyard to mark the anniversary AFP / MATEUSZ SLODKOWSKI

The communist regime backtracked on the deal in 1981, imposing martial law to crush Solidarity, which had snowballed into a movement of 10 million members, or more than one Pole in four.

Solidarity went underground, returning to the fore in 1989, when it negotiated a deal for free elections with the regime.

This victory accelerated the largely peaceful demise of the entire Soviet bloc over the next two years.

Awarded the Nobel Peace Prize in 1983 for his leadership of Solidarity, Walesa went on to become Poland's first democratically elected president after 1989.

Walesa placed flowers on the shipyard gate and symbolically opened it as he did four decades ago after inking the Gdansk Accords
Walesa placed flowers on the shipyard gate and symbolically opened it as he did four decades ago after inking the Gdansk Accords AFP / MATEUSZ SLODKOWSKI

Poland successfully adopted democracy and a market economy before joining NATO in 1999 and the European Union in 2004.

But now reforms by the ruling PiS are tarnishing its democratic credentials with critics, including the European Union, accusing it of eroding the independence of courts and the rule of law.

PiS insists the changes are necessary to tackle corruption in a judiciary still haunted by the legacy of communism.

The party, led by Walesa's arch-rival Jaroslaw Kaczynski, also insists that post-1989 Poland was established on the basis of a flawed compromise between the communists and the liberal wing of Solidarity.

The reforms launched by PiS and its rhetoric targeting Poland's LGBT community have divided Poles as never before.

PiS-allied President Andrzej Duda attended separate anniversary ceremonies Monday in Gdansk where he expressed support for protesters in Belarus demanding that strongman President Alexander Lukashenko step down over his allegedly rigged victory in August 9 elections.

The present-day incarnation of the Solidarity trade union counts some 500,000 members and is close to the PiS government, which has earned it criticism.

Marking the anniversary, German Chancellor Angela Merkel hailed the Gdansk shipyard workers who founded Solidarity as "European heroes of freedom", noting they "began a movement which ultimately led to the fall of the Berlin Wall and the end of the Iron Curtain".