Former Prime Minister Zoran Milanovic, who has pledged to make Croatia a tolerant country turning the page on its wartime past, has won Sunday's presidential runoff, defeating the incumbent conservative leader.

Milanovic, the Social Democrat candidate, took 52.7 percent of the vote, while President Kolinda Grabar-Kitarovic, who had tried to unite a fractured right wing, garnered 47.3 percent, according to results based on a vote count at nearly all polling stations released by the electoral commission. The turnout was about 55 percent.

More:

The second-round election was held just days after Croatia took the helm of the European Union for a six-month period that will be dominated by Brexit and the bloc's enlargement.

At the same time, the EU's newest member is struggling with a mass exodus of its people, corruption and a lacklustre economy at home.

Grabar-Kitarovic campaigned on a slogan promoting "real Croatia", hinting she believes the ruling conservative HDZ party that backed her was the only one who can truly represent the country.

Milanovic called such statements "very dangerous", and advocated for a "normal Croatia" as a liberal democracy that promotes equality for all citizens.

"Four million of us ... are looking for our place in Europe which is, despite all the problems, the nicest place to live, the most peaceful project in which Croatia must find its place and interest," Milanovic told supporters in Zagreb after his victory.

'United in differences'

"Let's be united in [our] differences," the 53-year-old said.

In the campaign, Milanovic stressed that the "wars are over", referring to Croatia's 1990s independence war that remains an emotive issue.

Despite her efforts, Grabar-Kitarovic, 51, the country's first female president, failed to lure back hardliners who had voted for a nationalist folk singer in the presidential election's first round in December.

She stressed unity, patriotism and references to the 1990s war in her re-election bid.

Conceding defeat on Sunday evening, Grabar-Kitarovic promised a "civilised transfer" of power to Milanovic.

She stressed that "Croatia needs stability" and unity as "we are the strongest when we are together".

Analysts say that Milanovic, who dominated in the cities, also won thanks in part to the split among the right wing.

The election was viewed as a key test for the ruling HDZ party of Prime Minister Andrej Plenkovic ahead of parliamentary elections later this year and Grabar-Kitarovic's loss was seen as a heavy blow.

"It will weaken the (HDZ) party" and harm Plenkovic's reputation, political analyst Tihomir Cipek said.

The prime minister is also facing the discontent of hardliners within the HDZ over his moderate policies.

Young people are leaving

Grabar-Kitarovic had presented herself as the "woman of the people" with humble farming roots.

She has also come under fire for downplaying the crimes committed by the pro-Nazi Ustasha regime that ruled the short-lived Independent State of Croatia during World War II.

Meanwhile, Milanovic, prime minister from 2011 until 2016 whose government failed to push through much-needed reforms, had sought to make a political comeback and throw off a reputation as arrogant and elitist.

He will now take office during Croatia's EU presidency where four main issues are likely to dominate - the bloc's relationship with the UK after Brexit; the membership bids of Western Balkan states; climate change; and the bloc's budget framework for the next decade.

The Adriatic country joined the EU in 2013, but its economy, strongly relying on tourism, remains one of the bloc's weakest.

The EU's open borders also accelerated the exodus of Croatians seeking better pay in wealthier member states.

Many emigrants also cite corruption, nepotism and poor public services as reasons for leaving.

"Politicians are wrangling about the past and insignificant issues while my generation is leaving," said Maja Maric, a 20-year-old economy student. She said she voted for a "lesser evil".