The energy crisis, soaring inflation and war in Ukraine could help Social Democrat Prime Minister Magdalena Andersson to secure another term in office if Swedes decide to vote for a safe pair of hands in Sunday's parliamentary election.

The closely fought election comes at a time when clouds are gathering over Sweden's economy. With energy costs rocketing as a result of Russia's decision to squeeze gas supplies to Europe, growth is set to slow next year with recession a distinct possibility.

Inflation is running at a pace unseen since the early 1990s and unemployment and interest rates are set to rise. House prices have already begun sliding.

This ought to give the right-wing opposition a golden opportunity to return to power after eight years of Social Democrat-led governments.

But experience dealing with crises could play into the hands of Andersson, 55, the finance minister from 2014 to 2021 who steered the economy successfully through the pandemic and spearheaded Sweden's bid to join the NATO military alliance as prime minister.

"She's the party's trump card," Nicholas Aylott, associate professor of political science at Sodertorn University, said.

"Swedish voters, like voters elsewhere, seem to be rallying around the flag ... during moments of uncertainty and crisis and that is favouring the Social Democrats."

While polls show the left and right blocs running neck and neck, the Social Democrats are the biggest party and Andersson easily outscores Moderate leader Ulf Kristersson - who has the backing of other right-wing parties - in voters' preferences.

A poll by Sweden's TV4 on Aug. 24, showed 39% of those questioned would choose Andersson as prime minister against 23% who preferred Kristersson, a former social security minister who has headed his party since 2017.

REFERENDUM ON SWEDEN DEMOCRATS

Andersson's experience and popularity as the first woman premier in a country that prides itself on equality could tip the scales in favour of the left, but there is another factor that could sway voters: the possibility that, with a right-wing victory, the far-right Sweden Democrats could gain a role in government.

Kristersson's Moderates have ruled out a coalition with the Sweden Democrats, a party with roots in the white-supremacist fringe and whose mantra is that Sweden's ills are due to decades of generous immigration policy.

However, after suffering two election defeats in a row, the Moderates, the Christian Democrats and the Liberals have agreed to cooperate with the Sweden Democrats, who have said they will support Kristersson as prime minister in return for tougher immigration and law and order policies.

Kristersson's decision to court the far right has alienated his former allies in the Centre Party and many voters.

"In a way, this is a referendum on the Sweden Democrats," said Peter Esaiasson, professor of political science at Gothenburg University.

"There is a choice you have to make in terms of what is the most important dimension in politics, is it left-right, or is it the moral dimension and concern about racism?"

Opinion polls show the Moderates losing to the Sweden Democrats for the position of second biggest party after Andersson's Social Democrats.

While few believe Akesson could become prime minister after Sept. 11, the chance he could wield influence on policy-making if the centre-right wins a majority could still put off many undecided voters.

If she wins, however, Andersson is unlikely to have an easy task forming a new administration - or staying in power.

It took months to sort out a new government after the previous vote in 2018 and the loose centre-left confederation agrees on little other than a desire to exclude the Sweden Democrats from power.

Both Stefan Lofven, the previous prime minister, and Andersson lost budget votes and were forced to resign - if only temporarily. The situation may be similar after Sunday's vote.

Whichever bloc wins faces a series of challenges - not least in bridging internal disagreements over policy.

The welfare system has been stretched by the pandemic and the shift to a greener economy will require huge investment in new technology and skills, as well as more clean power and a transmission grid that can deliver it where it is needed.

The war in Ukraine shows no sign of coming to an end and while Sweden's application to join NATO has been ratified by more than 20 alliance members, Turkey could still throw a spanner in the works.

"A strong government able to meet the societal challenges will be called for after the upcoming election," Swedbank said in its most recent economic outlook.

Few would bet on that.