The Swedish general election seems likely to produce a result nearly as unclear and emotionally charged as the Brexit referendum did in Britain. The traditional blocs on the left and right, which have tussled over power for nearly a century, have both been pushed aside by the populist and anti-immigrant Sweden Democrats (SD), who seem certain to hold the balance of power in parliament as they do now. No government can be formed without their cooperation unless other parties combined across their traditional blocs to form one whose main point is that it opposes the SD.

This would be a straightforward problem were it not that the Sweden Democrats are considered pariahs by all the other parties. In part this is because the SD has clear neo-Nazi roots. In part it is because the party’s simple message of ethno-nationalist nostalgia has a power that other parties have had a hard time countering. They are trying to face up to a difficult and uncertain future. The SD is simply appealing to a past in which Sweden was obviously (at least to Swedes) the best and richest country in the world. Those years were also those of the Social Democratic party’s dominance, and the SD’s rise has coincided with the collapse of the Social Democrats, who are in the latest polls heading for less than 25% of the vote, which would be their lowest total ever. It is also campaigning, both on the ground and in cyberspace, with an energy which other parties are finding hard to match.

Swedes are not more racist than most Europeans, or even than their Scandinavian neighbours: parties analogous to the SD have long been powerful in Denmark and Norway. But for the last two or three decades all the mainstream parties pretended that Sweden was not a racist country at all. This was the mistake whose consequences have paralysed Swedish politics. There is a diverse, but substantial anti-immigrant sentiment in the country, ranging from widespread unease about the gang violence in some immigrant suburbs to little pockets of organised neo-Nazis in the countryside. Although Sweden now has one of the most restrictive immigration policies in Europe, after having one of the most generous ones up until 2015, there is still little sense that any of the parties, least of all the Sweden Democrats, have realistic and coherent policies for managing and funding the integration of refugees.

Similarly, the mainstream parties share a confidence in the efficiency of the Swedish state that seems to many voters quite unfounded. The railway system and the postal service are now bywords for inefficiency. Scandals surrounding the public-private partnership effort to build a new flagship hospital in Stockholm have further discredited the previously fashionable ideology of privatisation.

No wonder that recent polls showed that around half of all Swedish voters have no faith in the future. This pessimism is aggravated, researchers say, by the filter bubble effect of social media. In a striking reversal since the 2014 election, the right now dominates Facebook with its message of impending apocalypse. All this suggests an election that will be a further triumph for ethno-nationalist populism. Yet these appearances may be deceptive and there are solid grounds for hope that they are. The economy is not in fact tanking. The apocalypse is not imminent. Even on the most pessimistic forecasts, four out of five Swedes will vote against the SD. The country remains prosperous and its politicians – whatever their differences – dedicated and honest. It will survive this crisis.