LJUBLJANA, Slovenia (AP) — Slovenia's President Borut Pahor, a former model and veteran politician known for his use of social media, won the most votes in a presidential election Sunday, but will face a runoff against an ambitious challenger.

A near-complete vote count showed Pahor received 47 percent of Sunday's vote. His closest rival, Marjan Sarec, a former comedian who is mayor of the northern town of Kamnik, had 25 percent.

Slovenia has a population of 2 million and is the homeland of U.S. first lady Melania Trump.

Nine candidates — including five women — were on the first round ballot for the largely ceremonial but still influential presidential post in the European Union member country.

Since no candidate won more than 50 percent of the vote, a runoff scheduled for Nov. 12 is needed.

Pahor said "I'll do my best to prove that I'm the best choice. I'm glad for the support that I got in the first round."

Pre-election surveys had shown that Pahor, 53, could win a majority of votes cast Sunday and therefore another term without a runoff election.

After results were announced late Sunday, Sarec suggested he had been underestimated in the polls and expressed confidence he would attract more voter support in the next three weeks.

"We will continue with the upward trajectory," the smiling Sarec told an applauding crowd in his campaign headquarters in Kamnik. "People know me and trust me, because I have a good track record."

After casting his ballot earlier on Sunday, Pahor said he knew that no Slovenian president in 20 years has won a second term in office. But he said "we did so much in five years" that it was worth his trying to seek re-election.

Pahor has been nicknamed Slovenia's "King of Instagram" for his frequent presence on social media. He walked about 700 kilometers (420 miles) during the presidential campaign, posting photos and short videos all along the way.

Critics think Pahor has degraded the presidency by turning himself into a celebrity.

Sarec, 39, starred in Slovenian satirical shows until he mounted an independent bid for mayor in 2010 and won against an established candidate. He is serving his second term as mayor and said Sunday he thinks Slovenia needs change.

Slovenia's presidency holds no executive powers but the president proposes the prime minister, who runs the government, and the president's opinion carries weight on important issues.

Other candidates included Romana Tomc, a tax expert backed by the conservatives; Ljudmila Novak, a former teacher who leads the New Slovenia Christian-Democrats; and Angelca Likovic, who is promoting Catholic Christian values.

Key topics facing Slovenia include the economy and a border dispute with neighboring Croatia stemming from the 1990s' breakup of the former Yugoslavia.