Ruling left-wing bloc moves to form alliance with centre-right bloc as anti-immigrant party emerges as a third force.

Swedish Prime Minister Stefan Lofven has invited the opposition to talks aimed at a “cross-bloc cooperation”, after his left-wing party failed to gain a majority in Sunday’s elections that saw anti-immigrant party making gains.

Lofven’s bloc remained the biggest with 40.6 percent of votes, marginally ahead of the centre-right Alliance, which garnered 40.3 percent in the polls, results showed after most votes were counted on Monday.

That gave the centre-left 144 seats in the 349-seat parliament against 142 for the Alliance, suggesting weeks of uncertainty before a workable government can be formed.

The nationalist Sweden Democrats (SD) vowed to exert “real influence” as kingmaker after emerging as the third-largest political force in one of Europe’s most liberal nations.

The SD, a party with roots in the neo-Nazi movement, won 17.6 percent and 63 seats, up from 12.9 percent and 49 seats in the last election four years ago, the biggest gain by any party in Sweden‘s parliament, the Riksdag.

Turnout in the election was reported at 84.4 percent, up from 83 percent in 2014.

Prime Minister Lofven, who brought the Social Democrats to power in 2014, said he intended to remain in the job.

Lofven invited the opposition to talks aimed at ‘cross-bloc cooperation’ [Jonas Ekstromer/via Reuters]

Sounding sombre and firm, Lofven told his supporters late on Sunday that 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 good forces. We won’t mourn, we will organise ourselves,” he said.

{articleGUID}

Final election returns were expected later in the week.

The results also fell short of SD leader Jimmie Akesson’s predictions of 20 percent of the vote or more. However, he told a party rally it was, nevertheless, the winner of the election.

“We have strengthened our role as kingmaker … We are going to gain real influence over Swedish politics,” he told cheering supporters at an election night party.

Mattias Karlsson, SD parliamentary leader, called the poll results “a political earthquake” and “rare to Swedish political history”.

“The leaders of the two big parties, the Social Democrats and the Moderate party, need to listen to this signal from the Swedish people, need to change the policies that the Swedish people want to see,” he said.

SD leader has vowed to exert ‘real influence’ as kingmaker [Anders Wiklund/via Reuters]

The SD, which wants Sweden to leave the European Union and freeze immigration, hopes it can play a decisive role in negotiations over forming a government.

The party has called on Ulf Kristersson, the centre-right Alliance’s candidate for the premiership, to choose between seeking support from the SD for an Alliance government or to accept another four years of Lofven.

Kristersson called on Lofven to resign, but rebuffed Akesson.

“We have been completely clear during the whole election. The Alliance will not govern or discuss how to form a government with the Sweden Democrats,” he said.

He said he planned to build a government that would “unite our country and take responsibility”.

Al Jazeera’s Jonah Hull, reporting from the Swedish capital, Stockholm, said it was unlikely that the SD would gain a role in government.

“No party at this stage is even willing to talk to them. But they will continue to exert indirect influence on the way ahead, having already succeeded, to the horror of many, in putting nationalism and identity politics on the Swedish agenda,” he said.

Sweden 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.