Sweden was looking at weeks of uncertainty and complex coalition talks after the country's two rival blocs failed to secure a clear governing majority in elections that saw a boost for a far-right party – considered political pariahs – amid growing discontent with large-scale immigration.
The governing center-left bloc had a razor-thin edge over the center-right opposition Alliance, with roughly 40 percent each.
However, both have vowed not to work with the Sweden Democrats, an anti-immigrant party with roots in a neo-Nazi movement, that won 17.6 percent in Sunday's election, up from the 13 percent it gained four years earlier.
The party, which has worked to moderate its image in past years and wants the country to leave the European Union, gained votes amid a backlash against the challenges of integrating hundreds of thousands of immigrants who arrived in the Scandinavian nation over the past years.
Prime Minister Stefan Lofven, who brought the Social Democrats to power in 2014, said he intended to remain in the job. His party emerged with the greatest share of the vote – 28.4 percent as the count neared completion – yet looking at holding fewer parliament seats than four years ago.
"I will not exclude any alternative to the [present] government. What I can exclude is any direct or indirect cooperation with the Sweden Democrats," Interior Minister Anders Ygeman, a Social Democrat, said.
"I believe that it must be the largest party in Sweden that forms a government. Historically it has been always been this way in Sweden," he said.
Political horse-trading began to try to form a government which could "takes week, months," Mr. Ygeman said, according to Swedish news agency TT.
The leader of the Moderates party that came in second, Ulf Kristersson, has already called on Mr. Lofven to resign and claimed the right to form Sweden's next government.
The center-right, four-party Alliance has said it would meet Monday to discuss how to move forward and demand that Lofven, head of the minority, two-party governing coalition, resign.
However, the Sweden Democrats have said they could not be ignored in coalition negotiations and vowed to use its grown influence.
"This party has increased and made the biggest gains. Everything is about us," its leader Jimmie Akesson said on election night. "I am ready to talk with others."
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.
With the prospect of weeks or months of coalition talks before the next government is formed, Swedish tabloid Expressen headlined its front page Monday: "Chaos."
Both the left-leaning bloc led by the Social Democrats and the center-right bloc in which the Moderates is the largest of four parties have said they would refuse to consider the Sweden Democrats as a coalition partner.
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.
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 Sweden, which a population of 10 million, took in a record 163,000 refugees in 2015 – the highest per capita of any European country.
Turnout in the election was reported at 84.4 percent, up from 83 percent in 2014.
This story was reported by The Associated Press.