Poland’s presidential runoff election was too close to call Sunday night as exit polling showed incumbent President Andrzej Duda ahead of challenger Rafal Trzaskowski.

If Duda — an ally of President Trump — is reelected, he could help Poland’s ruling right-wing party continue its hard-line policies, including efforts to force out independent judges, which have drawn rebukes from the European Union and human rights groups over the past five years.

But a victory by the centrist opposition would mark a stunning change in Polish politics, allowing the pro-European Trzaskowski to veto laws passed by the right-wing government, which holds a majority in the lower house of Parliament. Trzaskowski, the mayor of Warsaw, has vowed to return Poland to E.U. standards on the rule of law.

Incumbent Polish President Andrezj Duda is facing off July 12 against liberal Warsaw Mayor Rafal Trzaskowski in a close election. (Reuters)

A late poll showed Duda at 51 percent and Trzaskowski at 49 percent. Official results were expected Monday, but counting could take longer. Both candidates expressed optimism Sunday that they had won the election.

Pawel Zerka, a policy fellow at the European Council on Foreign Relations, noted that the exit poll during the first round of voting in June had underestimated support for Duda. But he said other factors, including overseas voters, could work in Trzaskowski’s favor.

Exit polling indicated the runoff might have drawn one of the highest presidential election turnouts since the end of communism three decades ago.

“It shows that [Polish] democracy is vibrant,” said Zerka. “But it’s also bad news, because it shows to what extent the society is really divided into tribes or camps. It is neatly divided in half.”

Duda came in first during the initial round of voting last month, but he failed to secure the majority he needed to avoid a runoff with Trzaskowski. Trzaskowski’s approval ratings have jumped since he entered the race in May.

With polls showing no clear favorite, both candidates made last-minute appeals to their supporters on Friday. Trzaskowski cautioned that a Duda win would allow the government to continue its course and suggested that a change in Polish politics had to be “now or never.”

Trzaskowski told The Washington Post that he had seen a “revival of the society, of all the people who want to be involved and who want to protest and who want change.”

Duda, who during the campaign suggested that efforts to advance LGBT rights were worse than communism, vowed Friday to strengthen the Polish state, which he said was “built on our inviolable and sacred tradition.” Duda’s campaign sought to highlight efforts by the ruling Law and Justice party to narrow inequality by expanding social benefits, which has mainly helped poorer voters in rural areas that are right-wing strongholds.

In Warsaw, a 74-year-old pensioner named Jadwiga said Sunday she voted for Duda in part because of more expansive pension payments passed by the right-wing parliamentary majority. A Trzaskowski win, she said, would benefit only “the elite, the rich people, who are in the minority in our country.”

“I am afraid that if Trzaskowski wins the election, Poland will not be Poland,” she added. She declined to give her last name.

Pawel Wojcik, a 40-year-old civil servant, said a Duda victory would mean a continued “violation of the constitution” and more division. A Trzaskowski victory, he said, would “guarantee that Poland will return to the path of respecting the rule of law.”

Earlier this year, Duda’s reelection appeared almost certain, with polls showing a comfortable lead. But his approval ratings declined during the spring as the first signs of a coronavirus recession took hold.

The Law and Justice party attempted to shield Duda from voter anger over the economy by trying to hold the first round of voting as scheduled on May 10, despite the country’s outbreak. But the vote was pushed back to June.

The leading Civic Platform opposition party replaced its earlier presidential candidate, who had failed to gain momentum, with Trzaskowski, who managed to re-energize the race by promising to unite the country.

While Trzaskowski has warned that a Duda win would continue Poland’s confrontation with the E.U., Duda has prioritized relations with the Trump administration. Days before the first round of voting, Duda flew to Washington to meet Trump at the White House.

Trump said he believed Duda would be “very successful.” But he made no commitment to permanently increase the number of U.S. troops in Poland — a key objective of the Law and Justice party.