STOCKHOLM – Sweden’s ruling party was headed for its worst showing in decades as voters flocked Sunday to an anti-immigrant party with white supremacist roots that was poised to become the third-biggest force in parliament.

With more than four-fifths of ballots counted, Sweden’s national election commission reported the governing Social Democrats had 28.1 percent of the vote, making it likely to lose a significant number of seats despite emerging with the most support.

The Moderates party was next at 19.2 percent, while the far-right Sweden Democrats that before the election inspired fear of an anti-migrant backlash that would produce a dramatic ideological swing had 17.9 percent.

The Sweden Democrats received 13 percent of vote in the last election held four years ago.

The results Sunday made it unlikely any single party would secure a majority of the 175 seats in the Riksdagen, Sweden’s parliament. It could take weeks or months of coalition talks before the next government is formed.

Both the left-leaning bloc led by the Social Democrats and the center-right bloc have said they would refuse to consider the Sweden Democrats as a potential coalition partner.

Sunday’s election was the first in Sweden since its government in 2015 allowed 163,000 migrants into the Scandinavian country with a population of 10 million. The number was far lower than the asylum-seekers Germany accepted that year, but the highest per capita of any European nation.

The Sweden Democrats – led by Jimmie Akesson – worked to soften its neo-Nazi image while helping to break down longstanding taboos on what Swedes could say openly about immigration and integration without being shunned as racists

The potential of a surge by the party had many Swedes worried about an erosion of the humanitarian values that have long been a foundation of their country’s identity.

“This election is a referendum about our welfare,” Prime Minister Stefan Lofven said. “It’s also about decency, about a decent democracy … and not letting the Sweden Democrats, an extremist party, a racist party, get any influence in the government.”

At the party’s rally on Saturday, Akesson strongly criticized Lofven’s government for “prioritizing” the cause of immigrants over the needs of citizens.

“This government we have had now . they have prioritised, during these four years, asylum-seekers,” Akesson said, giving an exhaustive list of things he says the government has failed to do for Swedish society because of migrants.