ZAGREB (Reuters) - Former Prime Minister Zoran Milanovic, candidate of the top opposition party the Social Democrats, will be Croatia’s next president, the results of the presidential election showed on Sunday.

Slideshow ( 16 images )

In the second and final round of the election, Milanovic won 52.7% of votes, while the incumbent Kolinda Grabar-Kitarovic, candidate of the ruling centre-right Croatian Democratic Union (HDZ) garnered 47.3% of the votes.

The president’s role is largely ceremonial in Croatia. The head of state cannot veto laws, but has a say in foreign policy, defense and security matters.

Milanovic, who served as prime minister from 2011 to 2015, ran his election campaign on a promise to fight corruption, which he said had increased since he lost power to the conservatives.

“Milanovic’s victory is a wind in the sails of the Social Democrats and will strengthen the party ahead of a parliamentary vote (due in the autumn),” political analyst Branko Caratan told state television.

In the first round of the election two weeks ago, Milanovic beat 11 other candidates to come first with 29.6% of votes, with Grabar-Kitarovic in second place with 26.7%.

“For me (from now on) each party will on the formal level be the same. I will cooperate with everyone who will have the executive power. I will not make divisions among the Croatian citizens,” Milanovic told his cheering supporters in the party campaign headquarters.

The outgoing president Grabar-Kitarovic in her speech wished Milanovic a successful five-year term in office which begins in February.

“It is in the interest of our country which needs to preserve stability,” she said.

While some analysts said Milanovic’s victory could hurt the standing of Prime Minister Andrej Plenkovic in his HDZ party, ahead of the party leadership election this year, others said he would be able to manage the challenge.

“I think that Plenkovic is a skilled politician who will know how to balance in the new situation,” Smiljana Leinert Novosel told state television.

Croatia took over the six-month rotating presidency of the European Union on Jan. 1.