An anti-immigration opposition party won Slovenia's parliamentary election yesterday, taking 25% of the vote, according to preliminary results.

However, the centre-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.

Mr 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," Mr 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 co-operation," he said.

Mr Jansa, who was prime minister from 2004 to 2008 and from 2012 to 2013, had said he would cut taxes and speed up privatisation.

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 ten-year time limit expired. Mr 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% of vote counted put the SDS ahead with 25 seats in the 90-seat parliament. A centre-left party, The List of Marjan Sarec (LMS), was in second place with 12.6% 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," Mr 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% compared with 51.7% four years ago.

The election was called in March after centre-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.

Mr Cerar's Party of The Modern Centre was in fourth place with just ten seats.