Mr. Duda, however, dismissed concerns about Poland’s illiberal drift as an invention of foreign interests looking to exert control over the nation. He cast himself as a defender of “traditional families” and attacked Mr. Trzaskowski over his support for L.G.B.T. rights — powerful arguments in a staunchly Catholic country, particularly outside its cosmopolitan cities.
The incumbent received a boost recently from President Trump, who met with him at the White House just days before the election and all but endorsed Mr. Duda. “He’s doing a terrific job,” Mr. Trump said. “The people of Poland think the world of him.”
An already bitter campaign turned even uglier in the final days before Sunday’s vote, with Mr. Duda, the Law and Justice party and its supporters in the right-wing media launching a barrage of attacks on Mr. Trzaskowski.
In the pro-government weekly Sieci, the Warsaw mayor was accused of supporting pedophilia. State television, which has been turned into a propaganda machine for the government, suggested that Mr. Trzaskowski would be controlled by Jewish interests in complicated questions related to restitution of property dating from World War II.
Xenophobic arguments are nothing new for Law and Justice, which took power in 2015 on a campaign against accepting migrants, has described itself as defending Christianity against foreign forces, and has tarred the European Union as a threat to national autonomy. But appeals tinged with anti-Semitism, in a country whose Jews were largely wiped out in the Holocaust, were generally off-limits until recently.
Independent news outlets faced escalating attacks during the campaign, with the governing party claiming that Germany and other outside powers were trying to meddle in the nation’s affairs.