An anti-immigration opposition party won Slovenia's parliamentary election on Sunday, taking 25 percent of the vote, according to preliminary results.
However, the center-right Slovenia Democratic Party (SDS) of former prime minister Janez Jansa may struggle to pull together a government as its hardline stance on immigration has left it short of potential coalition partners.
Jansa acknowledged any post-election negotiations would be difficult. "We will probably have to wait for some time ... before serious talks on a new government will be possible," he told reporters after he cast his own vote.
Voters in a number of eastern members of the European Union - notably Hungary and Poland - have turned to parties which oppose the bloc's plans under which countries would accept asylum seekers under a quota system.
The SDS, supported by Hungary's nationalist Prime Minister Viktor Orban, is firmly opposed to such quotas and says most of the money used to support them should be diverted to the security forces.
"(Our) party puts Slovenia, Slovenians first," Jansa said after preliminary results came out, adding that the SDS is ready for coalition talks with all other parliamentary parties. "We are open for cooperation, Slovenia is facing times which need cooperation," he said.
Jansa, who was prime minister from 2004 to 2008 and from 2012 to 2013, had said he would cut taxes and speed up privatization.
He spent six months in prison in 2014 after being convicted on bribery charges related to a 2006 arms deal but was freed after the Constitutional Court ordered a retrial which did not take place because a 10-year time limit expired. Jansa had denied any wrongdoing.
In a highly fragmented ballot, the Adriatic state's 1.7 million-strong electorate was choosing between 25 parties of which nine made it to the parliament.
The result with 99 percent of vote counted put the SDS ahead with 25 seats in the 90-seat parliament. A center-left party, The List of Marjan Sarec (LMS), was in second place with 12.6 percent of the vote and 13 seats.
LMS leader Marjan Sarec told reporters after preliminary results were released that he expected to get an opportunity to form a government, as most parties had said before the election that they were unlikely to join an SDS-led government.
"If everyone sticks to what they said before the election, we expect to get a chance to form a government," Sarec said.
President Borut Pahor has said he plans to give the first chance to form a government to the party with most seats in parliament after the election. However, the SDS would need to link up with at least two other parties to gain a majority.
Turnout was around 51.5 percent compared with 51.7 percent four years ago.
The election was called in March after center-left Prime Minister Miro Cerar resigned, weeks before his term was due to end. His departure followed a Supreme Court order for a new referendum on a railway investment project championed by his government.
Cerar's Party of The Modern Center was in fourth place with just 10 seats.
Jansa said the migration crisis is one of the biggest challenges that the EU faces, adding that it should work to improve conditions in countries where migrants come from.
Analysts say predicting what the future government might look like is hard and some believe another election could not be ruled out.
"There will be trouble in forming a government but still a government led by Jansa with at least one center-left party in it is the most likely outcome," said Peter Jancic, the editor of a political website Spletni Casopis.
Outgoing Foreign Minister Karl Erjavec, whose center-left party Desus got five seats, said his party was determined not to join a government led by Jansa, and added: "It is possible that we will have (another) early election."
Slovenia, which narrowly avoided a bailout for its banks in 2013, returned to economic growth in 2014. The outgoing government expects GDP to expand by 5.1 percent this year.
High on the agenda for the next government will be the privatization of the country's largest bank, Nova Ljubljanska Banka, which the previous administration agreed to sell in exchange for European Commission approval of state aid for it in 2013.
The new cabinet will also be expected to reform an inefficient state health sector and Slovenia's pension system.
The new parliament will have to confirm the next central bank governor, who will also sit on the European Central Bank's Governing Council, after the previous governor Bostjan Jazbec resigned in April to take a position on the EU's Single Resolution Board.