GDANSK, Poland — The struggle for freedom against tyranny in Poland in 1989 was defined by a single word: solidarity.
Workers and union leaders, teachers and students, church leaders and intellectuals united in a common cause that inspired the world, helped lead to the collapse of the Soviet Union, and set the nation on a course toward democracy.
On Tuesday, Poland marks three decades since its first elections after Communism. But that anniversary is best defined by another word: division.
Today Poland is split between supporters of the nationalist, autocratic model of the ruling party, and those favoring the ideals of liberal democracy embodied in the European Union. Elections later this year could decide which path the country pursues.
The government and its opponents both know that Poland’s decision for its future will be influenced by the narrative of its past. The anniversary has intensified a struggle to shape the nation’s historical memory.
In Gdansk, the port city where the spark of revolution first caught fire in the sprawling shipyards, groups broadly opposed to the government have organized days of concerts, forums and celebrations.
They are using the moment to talk about the dangers facing Poland’s democracy. They see a drift toward authoritarianism as the government tightens its grip on the media, state-owned businesses and the courts.
The government wants none of it. Instead, it has chosen this week to focus on another critical and unifying moment: the 40th anniversary of the first visit of the first Polish pope, Pope John Paul II, to Poland.
That focus on the pope’s visit is part of a broader campaign by the ruling party, Law and Justice, and its nationalist leader, Jaroslaw Kaczynski, to appeal to a wide swath of the public that feels that the state should promote social and cultural cohesion, namely a homogeneous, Catholic Poland.
But it is also part of a long effort by Mr. Kaczynski to claim ownership of modern Poland’s creation story and shape it to suit his nationalist agenda and marginalize his opponents.
For years, Law and Justice has been working to redefine the public understanding of what happened in 1989, casting it as “the original sin” of what it believes ails the country today — immigration, income disparity and liberal values imposed by the European Union.
Mr. Kaczynski argues that the decision to share power with the Communists to ensure a peaceful transition, rather than purge them from public life, allowed for an entrenched elite to take advantage of the emerging capitalist system and many ordinary Poles.
The concessions allowed “red spiders” — as the former Communists are frequently called — to infect the system, according to Mr. Kaczynski’s narrative. He argues that this is why the government now needs to recast so many institutions of Poland’s democracy, including its courts.
“The Polish public life has been shaped by this hybrid structure: It’s partly democratic, partly derived from Communism,’’ Mr. Kaczynski said in 2017.
‘‘This system is one huge rot and that rot needs to be treated,” he said. “Poland’s judiciary is one enormous scandal and we need to end it.”
That message, coupled with generous social welfare spending, has brought his Law and Justice party success in elections, most recently for the European Parliament.
The party crushed the opposition in the countryside — precisely where people were hardest hit in the transition from Communism in the 1990s as many state enterprises, including farms, closed practically overnight.
Those areas have mostly since recovered, but the memory remains. Mr. Kaczynski has worked to convince people there that they were betrayed in 1989 by his political opponents.
The hero of the Solidarity movement was Lech Walesa, the legendary union leader of the shipyard workers whose activism planted the seeds of the revolution that brought down Communism.
Mr. Kaczynski played a lesser role in the movement, and his twin brother, also named Lech, a more central one.
Lech Walesa would go on to become president in 1990. Lech Kaczynski would later also become president, from 2005 until 2010, when he died in a plane crash.
Today Jaroslaw Kaczynski, heir to his brother’s legacy, and Mr. Walesa embody the bitter rivalry that divides their revolutionary generation — and all of Poland.
Mr. Walesa remains widely respected for his actions in the 1980s but is a marginal figure in Polish politics. Mr. Kaczynski has taken every opportunity to attack his legacy, while trying to elevate the role his brother played during the Solidarity struggle.
Sitting in his office in Gdansk, lined with photos from his more youthful days of revolution, Mr. Walesa is dismissive of Poland’s “most powerful politician.”
“Don’t take Kaczynski seriously,” he said irritatedly. “He was such a terrible activist he was never even thrown into prison.”
At the time of the revolution, neither of the Kaczynski brothers were part of the small, radical contingent arguing for a punitive approach to the former Communists.
“They both knew the need and supported the decision to leave Communists in public life because it was the only way to achieve a bloodless transition,” recalled Bogdan Borusewicz, a prominent democratic opposition activist who now serves as the deputy speaker of Poland’s senate.
Early on, after Mr. Walesa was elected president, the brothers worked closely with him. It was only after Mr. Walesa fired the brothers in 1991, following an intense power struggle, that Mr. Kaczynski began to talk about the failures of the round-table talks between the Solidarity movement and the Communist leadership that led to the 1989 elections.
The country was squandering a golden opportunity in his estimation.
“Poland is wasting — perhaps for generations — its chance, which happened to it for the first time in three centuries!” Mr. Kaczynski said in a 1994 interview with the author Teresa Toranska for her book “We.”
“Poland is ruled by a system and its further domination will end with the disappearance of this state, don’t you see that?!” he said.
He said that even though the Communists agreed to relinquish power, they demanded that their “economic interests be protected” and that they will “become the new middle class that is to emerge here.”
At the time, the effort to redefine the transition as a terrible tragedy did not gain much traction. Poland was not interested in looking backward. Joining NATO, entering the European Union and building a thriving market economy were the goals in front of the country.
“The last 30 years have been the best years in Poland in the last 300 years,” said Jacek Bendykowski, the president of the Gdansk Foundation and a member of the Young Poland Movement during the fight against Communism.
“For the rational part of society, they understand that, and that is why this anniversary is a cause for celebration,” he said.
While nearly all Poles recognize how much life has improved in the country, there is also a deep fear among many that something is being lost as the country embraces capitalism.
“For people raised in the flat society of Polish People’s Republic,’’ said Mr. Bendykowski, referring to the Communist period, ‘‘the idea that we are all equal, that we all have equal stomachs remains a powerful force.”
Mr. Kaczynski has skillfully used the politics of history to tap the underlying grievances of his supporters.
When it comes to the struggle to control the narrative of Poland’s revolution against Communism, he has used the levers of the state.
Basil Kerski knows that well. He has been the director for eight years of the European Solidarity Center in Gdansk.
“It was established to strengthen democratic culture,” he said. “And that means not only supporting the party in power.”
That does not sit well with Law and Justice, he said. Last year, the central government cut its funding for the center from $1.8 million to $1 million. A government minister said the cuts simply restored the funding to its original level.
Mr. Kerski, however, said he has come under pressure to lessen the prominence given to Mr. Walesa and, instead, cast Mr. Kaczynski’s brother, Lech, as Solidarity’s hero.
“In Poland, there is no more important symbol of democracy than Solidarity,” Mr. Kerski said. “The real battle for history is to control the symbols of that history.”