Poland's conservative President Andrzej Duda won a narrow majority in a bitterly fought weekend election, defeating the liberal Warsaw mayor, according to a near complete count of votes.
The state electoral commission said that Duda had 51.21% of the vote based on a count of votes from 99.97% districts. His opponent, Rafal Trzaskowski, trailed with 48.79% of the vote.
The head of the commission, Sylwester Marciniak, said final official results would only be announced later. They could vary slightly, but with Duda having nearly half a million votes more than Trzaskowski, they are not expected to reverse Duda's victory.
The very close race reflected the deep cultural divisions in this European Union nation.
It followed a bitter campaign dominated by issues of culture in which the government, state media and the influential Catholic church all mobilized in support of Duda, a social conservative.
Duda, who is backed by the ruling right-wing Law and Justice party, campaigned on traditional values and social spending in this mostly Catholic nation as he sought a second five-year term.
As the race became tighter in recent weeks, Duda turned further to the right in search of votes. He seized on gay rights as a key theme, denouncing the LGBT rights movement as an "ideology" worse than communism.
Trzaskowski, as Warsaw mayor, signed a tolerance declaration for LGBT people that triggered a nationwide backlash. The ruling party denounced LGBT rights as a foreign import that threatens Polish identity, and many municipalities declared themselves to be "LGBT free."
The European Union has denounced the anti-gay rhetoric and gestures and some officials have called for EU funding to be denied to the communities that declared themselves to be "LGBT free," mostly a symbolic gesture but once that has caused gays and lesbians to live in fear.
Duda's campaign also cast Trzaskowski as someone who would sell out Polish families to Jewish interests, tapping into old anti-Semitic tropes in a country that was home to Europe's largest Jewish community before it was decimated by Germany in the Holocaust.