SZCZECIN, Poland — The possibility that the mayor of Warsaw could unseat Poland’s president in Sunday’s runoff election had people packed into the central square of this northwestern city this week — their political hopes outweighing fears of the coronavirus.

Standing in the crowd, artist Joanna Zbikowska, 55, said Sunday’s voting might be “the last chance to change” Poland’s political course after five years of expanding power by the right-wing Law and Justice party.

Its hard-line policies, including efforts to force out independent judges, have brought denunciations from rights groups and others that the country is drifting from European Union standards on the rule of law.

In April, the Court of Justice of the European Union, the bloc’s highest court, ordered Poland to suspend a special panel with the power to prosecute judges, after critics said it could be used against those seen as opposing the government.

Still, Poland’s president, Andrzej Duda, was comfortably ahead in the first round of voting last month. But polls predict a far closer race heading into Sunday’s runoff with Warsaw’s pro-European mayor, Rafal Trzaskowski, who has promised to stand up for a more tolerant and less-divided country.

At a rally Wednesday in Szczecin, Trzaskowski’s supporters waved E.U. and Polish flags, and some wore rainbow-colored masks.

“It’s a dream about Poland full of open, tolerant, brave and rebellious people,” Trzaskowski said of his vision for the country.

U.S. politics in background

Michal Jakuszewski, 28, who attended the rally with his wife and 2-month-old daughter, said he voted for Duda five years ago and now backs the Warsaw mayor. He said he does not want Poland to look like the United States under President Trump.

The comparisons with U.S. political battles are not coincidental.

Only days before the first round of voting, Duda met Trump in Washington in what was seen as an effort to boost his campaign. Trzaskowski has since spoken to former president Barack Obama.

“Certain independent institutions are under attack,” Trzaskowski told The Washington Post after Wednesday’s rally. “There is a great danger that the government will continue with its policies of politicizing independent institutions.”

While Poland’s presidents have traditionally played a mostly ceremonial role, the office’s veto power could give Trzaskowski leverage over the Law and Justice party in Parliament, where it has held a majority in the lower house since the 2015 elections. The next parliamentary elections are expected more than three years from now.

As Trzaskowski caught up in the polls in recent weeks, amid the first repercussions of a coronavirus-induced recession, Duda doubled down on polarizing remarks. He suggested that efforts to advance LGBTQ rights were worse than communism and called the main opposition party worse than the coronavirus.

Meanwhile, Poland’s state-run broadcaster has turned into a “campaign tool for the incumbent” with “xenophobic and anti-Semitic undertones,” according to a report by the Organization for Security and Cooperation in Europe.

Steady climb in polls

Meanwhile, Trzaskowski has sought to frame himself as a leader who can unite but is also able to stand his ground against the ruling party. Since he entered the presidential race in May, Trzaskowski’s approval ratings have risen by 34 percentage points, to 45 percent, according to a Kantar poll.

The son of one of Poland’s most renowned jazz pianists, Trzaskowski spent years as an academic and European Union expert, speaking five languages and boasting of a collection of more than 10,000 books. He served as a member of the European Parliament, as Polish minister of administration and digitization, and then as Poland’s Europe minister.

When Trzaskowski was picked in 2018 as the opposition party’s mayoral candidate in Warsaw, an opposition stronghold, it came as a surprise to some political commentators. They wondered if Trzaskowski, who had a reputation as a cautious intellectual, would fit into a political landscape that was increasingly dominated by deep rifts and, at times, brutal animosity between the government and the opposition.

Trzaskowski avoided the personal attacks that are now common. Ads portrayed him as open-minded, savvy and global. He won the race for city hall by a landslide.

“This is when Trzaskowski, the fighter, was born,” said Jaroslaw Flis, a sociologist at Jagiellonian University in Krakow. “He didn’t take anything for granted but proved himself in a vicious battle.”

His track record as Warsaw mayor is more divisive, however.

While he is seen as an effective campaigner, some critics complain that he shies away from bold action if it could prove controversial.

“While every major city in Western Europe makes itself friendlier to pedestrians and cyclists, Trzaskowski is too afraid to introduce any project that would irritate car drivers,” said Jan Mencwel, the head of the City is Ours association, Warsaw’s leading group focusing on urban life.

Hedging political bets

In February 2019, the newly elected Trzaskowski signed an “LGBT+ Declaration” for Warsaw that included commitments to combat discrimination and violence against the LGBT community.

It sparked a right-wing backlash, including the declaration of “LGBT free” zones in almost 100 communities and cities, mostly in the conservative southeast of the country.

Analysts said the reaction was a key lesson for Trzaskowski.

Throughout his subsequent presidential run, he has mostly avoided proactively discussing LGBT topics, in what some analysts say is a turn to pragmatism in a country where the vast majority of people are Roman Catholic and many hold conservative views. Trzaskowski recently said he is not in favor of allowing same-sex couples to adopt children.

He has also sought to reach out to poorer and more religious rural areas — Law and Justice strongholds — which have benefited from major governmental social programs.

Trzaskowski’s outreach appears to have been driven by a political calculus. He will probably need to win over at least some supporters of far-right candidate Krzysztof Bosak, who dropped out after the first round.

“Even if he loses the runoff, he still is a mayor, still young, with nationwide name recognition and good prospects for the future,” sociologist Flis said.

But at Trzaskowski’s rally in Szczecin, many supporters voiced concerns over what’s next if his presidential bid falls short.

Zbikowska, the artist, said her older son had already emigrated to London “because of money . . . because of hate.” If Trzaskowski wins, she hopes she can persuade at least her younger son to stay in Poland.

Kalan reported from Warsaw.