Andrzej Duda / Photo from president.gov.ua

Incumbent Andrzej Duda was marginally ahead in Poland's presidential election on Sunday, an exit poll found, in a result seen as likely to have profound implications for Warsaw's relations with the rest of the European Union.

The re-election of Duda, an ally of the ruling nationalists Law and Justice (PiS), is crucial if the government is to implement in full its conservative agenda, including judicial reforms that the European Union says are undemocratic, Reuters reported.

Duda's challenger, liberal Warsaw Mayor Rafal Trzaskowski, has pledged to repair Poland's relations with Europe and use the presidential veto power to hold back any legislation that would subvert the rule of law.

Read alsoPoland resumes mandatory quarantine for air passengers arriving from Ukraine

The exit poll by Ipsos showed Duda winning 50.4% of the vote, while Trzaskowski, the preferred candidate of the main opposition party, the centrist Civic Platform (PO), had 49.6%. Ipsos said it was too early to call a winner.

"All we need is to count the votes. The night will be tense but I am certain that when the votes are counted, we will win," Trzaskowski told supporters in a park just outside Warsaw's historic Old Town.

Partial official results are expected on Monday.

Opinion polls before the election had shown the candidates, both 48, neck and neck, with Trzaskowski having closed the gap on Duda, who initially looked like a clear favourite.

Backed by the government, Duda ran an acrimonious campaign, laced with homophobic language, attacks on independent media and accusations levied against Trzaskowski that he would serve foreign interests instead of Poland's.