(Adds late poll result)
By Anna Koper and Joanna Plucinska
WARSAW, July 13 (Reuters) - Incumbent Andrzej Duda's marginal lead in Poland's presidential election was widening, a late poll showed on Sunday, a result, which while still uncertain, could have profound implications for Warsaw's relations with the European Union.
The late poll combines exit-poll data with partial official results.
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.
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.
The late poll by Ipsos showed Duda winning 50.8% of the vote, while Trzaskowski, the candidate of the main opposition party, the centrist Civic Platform (PO), had 49.2%.
The late poll showed Duda's lead widening from the 50.4% he had in an exit poll.
"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 after the exit poll.
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.
Duda, a devout believer, had painted himself as a defender of Catholic values and of the government's generous social benefit programmes that have transformed life for many, especially in the poorer rural regions of the country.
He appeared conciliatory on Sunday. "If anyone was offended by anything I did or said in the last five years, not just during the campaign, please accept my apology," he told supporters in Pultusk, a small town north of the capital.
Vote-counting was expected to continue through the night, but the electoral commission said it would not announce partial results as it has done in the past, but only the final result, possibly on Monday.
Borys Budka, the head of Trzaskowski's PO party, said it was "a scandal" that some voters abroad did not receive their mail-in ballots on time. "This a great failure of the state, regardless of who wins," Budka told private broadcaster TVN24.
The election was the first time all voters had a choice to cast ballots by mail, a change in rules necessitated by the coronavirus pandemic.
For many religious conservatives in Poland, Trzaskowski came to represent the threats facing traditional values when he pledged to introduce education about LGBT rights in the city's schools.
The archbishop of Krakow, Marek Jedraszewski, told worshippers in the southern city of Czestochowa on Saturday that Poland faced a "lethal danger" from ideologies that seek to undermine the traditional family structure and corrupt children.
Trzaskowski says he seeks a more tolerant Poland and has criticised PiS' rhetoric, vowing to abolish state news channel TVP Info, which critics say gave overt support to Duda in its programming.
"In politics, you should have opponents, not enemies," Trzaskowski said on Sunday. "They thought they had full power, but today they have fear in their eyes."
Duda' re-election to a second five-year term would open up the prospect of three years of uninterrupted rule by PiS, which has controlled the powerful lower house of parliament since 2015, with the next national election scheduled for 2023.
Observers say his defeat could undermine the fragile parliamentary majority that supports the PiS government, raising the spectre of political instability as Poland is coping with the economic fallout from the coronavirus pandemic.
"It's the first time since 2015 when we are not discussing the scale of a PiS victory but whether it will win at all," said Rafal Chwedoruk, a political analyst.
The election is being closely watched in Brussels.
Before PiS and Duda came to power in 2015, Poland had one of the most pro-European administrations in the bloc's ex-communist east. But it has grown increasingly isolated, with divisions focusing on climate change and migration, in addition to democratic norms.
(Additional reporting by Alan Charlish, Pawel Florkiewicz, Marcin Goclowski and Alicja Ptak; Writing by Alan Charlish and Justyna Pawlak; Editing by Frances Kerry, Louise Heavens and Peter Cooney)
Our Standards: The Thomson Reuters Trust Principles.