WARSAW — Poland’s governing party swept to power five years ago by appealing to a sense of aggrieved nationalism, and moved quickly to transform the state in ways that critics contend has torn at the fragile fabric of its democracy.
In May, as the good will enjoyed by the government in the early days of the pandemic gave way to uncertainty and angst, the governing Law and Justice party was desperate to hold presidential elections.
With people still sheltering in their homes, officials proposed a hastily arranged “election by mail.” But with orders already in to print 30 million mail-in ballots, Law and Justice was forced to retreat just days before the vote after being rebuffed by the courts and the opposition.
On Sunday, voters will finally get their say.
It will be the first presidential election in the European Union since the outbreak of the virus. And a contest that had looked all but certain to result in the re-election of President Andrzej Duda, a Law and Justice party loyalist, has suddenly become too close to call, polls suggest.
The delay in the planned election allowed Warsaw’s mayor, Rafal Trzaskowski, to enter the race as the candidate from the centrist Civic Platform coalition. Most polls indicate that no candidate is likely to secure the 50 percent needed to avoid a runoff election.
With just 285 new infections reported on Friday and the virus under control in most parts of the country, most people will go to their usual polling stations to vote. In areas where the virus is still believed to be spreading — small communities in the southwestern part of the country that have experienced recent outbreaks — the health ministry is requiring about 10,000 people to vote by mail.
A four-member delegation from the Parliamentary Assembly of the Council of Europe is in the country to monitor the process for fairness and to assess coronavirus precautions.
It is impossible to know what the political fallout of the pandemic will ultimately be, but the election is a reminder that the many divisions coursing through Poland and across the continent have not disappeared because of the outbreak. In fact, they may have hardened.
The battle lines are by now familiar: Poland is grappling with generational, geographic and cultural divides that have been aggravated by a brand of populism that has stoked often explosive passions.
Sunday’s election is widely viewed as one of the most consequential since the country liberated itself from communist rule three decades ago and set about establishing democratic institutions.
Those institutions, according to E.U. leaders and outside experts, have been under assault since Law and Justice came to power.
The Polish government has pressed ahead with efforts to overhaul the court system despite years of warnings from E.U. leaders that the changes threaten judicial independence and run counter to core Western values. Most recently, the European Union’s highest court introduced measures to halt Poland’s widely criticized forced retirements of judges.
The same court also found Poland broke international law by drastically increasing logging in one of Europe’s last primeval woodlands — just one of many fights on environmental issues that have made the country an outlier in Europe.
And recent efforts by local leaders to create zones “free from L.G.B.T. ideology” have led some European Union officials to suggest penalizing Poland by withholding pandemic relief funds.
The party has tried to tighten Europe’s most restrictive policies on abortions, only to relent after tens of thousands of protesters took to the streets. It has also turned public television into a propaganda arm of the government.
Jaroslaw Kaczynski, the leader of Law and Justice and the party’s chief architect, has often tried to cast the long list of concerns as nothing more than assaults on Poland by outsiders who want to keep the country “on its knees.” He has accused the opposition of creating a “whole machine which makes our compatriots believe that the good is evil and evil is the good.”
“The old principle according to which a lie told numerous times infiltrates the social awareness and in that sense becomes the truth is still present in the actions of the opposition,” he wrote in a letter to party leaders on June 9.
Mr. Kaczynski’s party has also been at the vanguard of casting the L.G.B.T. rights movement as symbolic of decadence, rhetoric that has been blamed for fueling violence by far-right groups in recent years at pride marches.
Mr. Duda opened his campaign by vowing to protect “traditional families.” He launched a withering attack on gays and lesbians — a frequent target of the ruling party — comparing homosexuality with communist ideology that was “force feeding our children.”
After international criticism, and in advance of a visit to Washington on Wednesday to meet with President Trump, he toned down his homophobic rhetoric and focused more on economic issues.
“Look at the pages of history,” the president told supporters in a speech on Krakow’s medieval market square last week. While the virus has helped drive unemployment up to around 6 percent, he said, joblessness was still lower than when the opposition controlled the government. “They were a worse type of virus than the coronavirus,” he said.
Mr. Duda hoped that his visit to the White House on Wednesday would give his campaign a boost. But he did not come away with anything of substance from the meeting with President Trump and his opponents were quick to cast the trip as an act of desperation.
There are 11 candidates in the race, and should the voting force a runoff as expected, the top two finishers will face each other on July 12.
If the opposition rallies around Mr. Trzaskowski, Warsaw’s mayor, and he makes it to the runoff, Mr. Duda will need to draw support from the country’s far right, which took in roughly one million votes in parliamentary elections — setting the stage for a bitter fight.
Mr. Trzaskowski made international headlines for his vocal support of L.G.B.T. rights after drawing a third more votes than any Warsaw mayoral candidate in the past two decades as turnout surged in 2014.
Wojciech Przybylski, the editor in chief of Visegrad Insight, a policy journal focused on Central Europe, said that Mr. Trzaskowski was avoiding a trap that past opposition candidates had fallen into.
His campaign slogan boils down to a simple message: Enough is enough.
“For the first time in the last five years, Law and Justice and Andrzej Duda are unable to generate new promises that would resonate in a wider public, and went on the defensive with a strong negative campaign,” Mr. Przybylski said. “While Rafał Trzaskowski effectively captured the momentum with messages of hope and change.”
Mr. Trzaskowski, a 48-year-old multilingual former E.U. minister, has said he will continue the generous social welfare programs that have been at the heart of the public’s support for Law and Justice.
But he said he would end an era dominated by political division.
“Real experts, professionals have been put on the sidelines,” he said. “We need professionalism today; we need people who will not divide us but will think how to deal with the most pressing issues.”
“The epidemic has proved that we are all thinking about the same thing — health, security, equal opportunities in education,” he said during a recent speech in Wałbrzych, a former coal mining city in southwest Poland. “In all of Poland we have the same problems.”
Joanna Berendt and Anatol Magdziarz contributed reporting from Warsaw.