Sweden's ruling party was headed for its worst showing in decades as voters flocked to an anti-immigrant party with white supremacist roots that was poised to become the third-biggest force in parliament.
With most ballots counted, the ruling center-left Social Democrats had 28 percent of the vote, trailed by the Moderates with 19 percent and the nationalist Sweden Democrats with nearly 18 percent.
The Sweden Democrats, born as a far-right political movement and now an anti-immigration party, garnered a little under 18% of the vote.
The Sweden Democrats, who want the country to leave the European Union and put a freeze on immigration, have about 17 per cent, up from the 13 per cent they scored in the 2014 vote, opinion polls suggest.
In Sweden, the speaker of parliament typically consults all party leaders after an election before tasking the one most likely to succeed at forming a government.
The four-party Alliance - made up of the conservative Moderates, Christian Democrats, Liberals and Center - rejected Lofven's invite, urging him to resign as it reiterated its determination to form its own government.
The election was Sweden's first since the government allowed 163,000 migrants into the country - the most per capita of any European nation - during Europe's 2015 migration crisis, polarising the nation's 7.3 million voters and magnifying popular concern about a welfare system many felt was already under strain.
The Sweden Democrats (SD) are expected to achieve 19.2% of the vote.
Presidential candidate stabbed at rally, in serious condition
The attack comes at a time of increasingly heated rhetoric, and sometimes violence, related to campaigns and candidates. The other presidential candidates were also reportedly quick to denounce the attack.
The potentially promising prospects of the far-right Sweden Democrats had many other Swedes anxious about an erosion of the humanitarian values that have always been a foundation of the Scandinavian country's identity.
Party leader Jimmie Akesson said the party has "won" Sweden's national election if you looked at the number of seats gained.
The often antagonistic campaign was largely dominated by themes of immigration, integration and welfare, with the Sweden Democrats repeatedly presenting the vote as a straight choice between immigration and welfare spending.
Polls showed established parties losing some support, including the centre-left parties which earlier favoured open-door policies.
Akesson responded that state television shouldn't take sides, and later announced that he wouldn't take part in any of SVT's election programs Sunday. Lofven accused some of his opponents of being prepared to work with the far-right party, which he vowed his party would not to.
"But it will not happen in cooperation with the Sweden Democrats".
Such an outcome could weaken the Swedish crown in the short term, but analysts do not see any long-term effect on markets from the election because economic growth is strong, government coffers are well stocked and there is broad agreement about the thrust of economic policy. As freelance journalist Sidsel Overgaard reported for NPR's Weekend Edition Saturday: "Sweden does not track the ethnicity of perpetrators, so making a connection between immigration and crime is a largely speculative exercise".
Speaking to supporters late Sunday Kristersson said he planned to build a government that would "unite our country and take responsibility".