Voters handed Sweden's ruling party its worst-ever election result Sunday and delivered a parallel lift to a far-right party with white supremacist roots, leaving the ideological outline of the Scandinavian country's next government uncertain.
After a campaign dominated by debates over immigration, the center-left Social Democratic Party emerged with the greatest share of the vote — 28.4 percent as the count neared completion — yet looking at holding fewer parliament seats and having its mandate to govern questioned.
The potential for an immigration backlash to result in a big boost for the far-right Sweden Democrats inspired fear among many Swedes before the election. It received a little more than one in six votes, or 17.6 percent. Its showing was not as strong as the one-in-five polls had predicted, but good for a third-place finish that had the party's leader telling supporters, "We won."
Prime Minister Stefan Lofven, who brought the Social Democrats to power in 2014, said he intended to remain in the job. The leader of the Moderates party that came in second, Ulf Kristersson, already had called on Lofven to resign and claimed the right to form Sweden's next government.
Sounding somber and firm, Lofven told his supporters the election presented "a situation that all responsible parties must deal with," adding that "a party with roots in Nazism" would "never ever offer anything responsible, but hatred."
"We have a moral responsibility. We must gather all forces for good. We won't mourn, we will organize ourselves," he said.
Final election returns were expected later in the week. The preliminary results made it unlikely any party would secure a majority of 175 seats in the 349-seat Riksdag, 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 in which the Moderates is largest of four parties have said they would refuse to consider the Sweden Democrats as a coalition partner.
Sweden — home to the Nobel prizes and militarily neutral for the better part of two centuries — has been known for its comparatively open doors to migrants and refugees. Sunday's general election was the first since the country of 10 million took in a record 163,000 refugees in 2015 as mass migration to Europe rose dramatically.
Lofven eventually said Sweden no longer could cope with the influx and immigration laws were tightened.
Like other far-right parties in Europe, the Sweden Democrats worked to soften its neo-Nazi image in the lead-up to the election. The party symbol was switched from a flaming torch to a flower. Members known for making pro-Third Reich statements were pushed out.
It made its first mark in politics with municipal council seats in 2006, and since then slowly helped revise long-accepted social norms for what Swedes could say openly about foreigners and integration without being considered racist.
At the Swedish Democrat's election eve rally Saturday, party leader Jimmie Akesson criticized Lofven's government for "prioritizing" the needs of new immigrants the ones of Swedish citizens.
Akesson was jubilant as he addressed supporters a day later, declaring the estimated 14 parliament seats the Social Democrats picked up a victory other parties could not ignore in coalition negotiations.
"This party has increased and made the biggest gains. Everything is about us," Akesson said. "I am ready to talk with others"
Turnout in the election was reported at 84.4 percent, up from 83 percent in 2014.
Olsen reported from Copenhagen, Denmark. Jeff Schaeffer and Philipp Jenne in Stockholm, Jari Tanner in Helsinki and Vanessa Gera in Warsaw contributed.
This version corrects the description of the Sweden Democrats' former party symbol.