STOCKHOLM (Reuters) - Sweden faced weeks of uncertainty after its mainstream centre-left and centre-right blocs emerged in a dead heat from an election on Sunday, while the far-right - which neither wants to deal with - made gains on a hardline anti-immigrant platform.
With nearly all votes counted on Monday, the ruling centre-left Social Democrats and Greens and their Left Party parliamentary ally had 40.6 percent of the vote, while the opposition centre-right Alliance was on 40.3 percent.
The Sweden Democrats, a party with white supremacist roots, came third with 17.6 percent, about 5 percentage points more than four years ago. The result was largely in line with the conventional opinion polls but below the 20 percent or more figure that some surveys had predicted.
"Most pointed towards the Sweden Democrats taking over the position as the second-biggest party in Sweden. But the expected ... bang did not happen," the liberal Expressen daily said in an op-ed piece.
"We need to be sincerely grateful for that. Sweden is now on steadier grounds than what we could have feared before the election."
But while there was a sense of relief among supporters of mainstream parties about the nationalist group's more limited than expected gains, the election underscored a broader shift to the right in one of Europe's most socially progressive nations.
Their success follow a rise in popularity for other far-right parties in Europe amid growing anxiety over national identity, the effects of globalisation and fears over immigration boosted partly by conflicts in the Middle East and North Africa.
Sweden saw itself as a "humanitarian superpower" for years, but a rise in gang violence in areas of high unemployment has won support for the Sweden Democrats.
After the arrival of 163,000 asylum seekers in 2015 - the most in Europe in relation to the country's population of 10 million, the centre-left government had suspended some of its liberal asylum policies.
Senior figures in the mainstream parties were expected to meet later on Monday to begin producing a strategy for forming a government. But the process could take weeks and possibly fail, with the Sweden Democrats vowing to sink any cabinet that doesn't give them a say in policy.
"We will gain huge influence over what happens in Sweden during the coming weeks, months and years," party leader Jimmie Akesson told supporters on Sunday night.
Akesson hopes his party, which wants Sweden to leave the European Union and freeze immigration, can play a decisive role in negotiations over forming a government.
He called on Ulf Kristersson, the centre-right Alliance's candidate for the premiership, to choose between seeking support from the Sweden Democrats for an Alliance government or to accept another four years of Social Democrat Prime Minister Stefan 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.
A new election will be called if parliament doesn't agree on a prime minister after four attempts.
The Swedish crown strengthened against the euro over the weekend, trading at 10.44 crowns at 0729 GMT against a last quote on Friday of 10.49 crowns, following the Sweden Democrats smaller than expected gains.
(Reporting by Justyna Pawlak, Anna Ringstrom and Olof Swahnberg; editing by David Stamp)