Tough talks and trade-offs await the winning side in Sweden's parliamentary elections with the governing centre-left and their right-wing challengers facing weeks of uncertainty should they come out on top.
Opinion polls ahead of the Sept. 11 vote show Social Democrat Magdalena Andersson and her allies running neck-and-neck with a right-wing bloc where Ulf Kristersson, leader of the conservative Moderates, is the main candidate to unseat her as prime minister.
Below is an explainer on the elections and the process to form a government.
WHO ARE THE CONTENDERS?
Andersson, the first woman to become Swedish prime minister after Stefan Lofven unexpectedly stepped down last year, is more popular than her own party and the political leader most trusted among voters, opinion polls show.
Still, the four-party centre-left bloc that would favour her as prime minister is only loosely aligned, even if the Social Democrats are by far the biggest player.
Meanwhile, their allies the Greens have been polling dangerously close to the 4% threshold to win Riksdag seats, as have the right's Liberals, adding uncertainty.
On the right, Kristersson's Moderates are vying with the anti-immigration populists of the Sweden Democrats to be the biggest party of that bloc.
Recent polls show the Sweden Democrats running ahead of the Moderates, raising doubts about Kristersson's plans to become prime minister in coalition with the Christian Democrats, but with Sweden Democrat and Liberal support in parliament.
Kristersson, a career politician for years eclipsed by former Prime Minister Fredrik Reinfeldt, who championed a more centrist and pro-immigration agenda, has said he is the only leader capable of uniting the right.
"It won't be easy, but it is totally doable," Kristersson told Reuters on the campaign trail in Gothenburg. "We are already sitting down together and we can talk to each other."
Yet the strong support for Jimmie Akesson's Sweden Democrats, founded decades ago in part by activists with neo-Nazi and white supremacist links, make them increasingly hard to ignore when considering a right-wing government.
WHAT ARE THE MAIN ISSUES?
Gang violence, with shootings spreading out of the main cities, has taken centre stage in the campaign with all sides pledging to further tighten legislation and expand the police force.
The Sweden Democrats, above all, link crime with the influx of immigrants over the past decades. Roughly 20% of Sweden's 10.5 million inhabitants were born abroad, according to government statistics, with Syrians the largest group.
Sweden has clamped down on immigration since the 2015 refugee crisis, under two straight terms of Social Democrat rule. The right would go further, especially the Sweden Democrats who have listed 30 reforms they say would cut asylum approvals to almost zero.
In recent months, soaring inflation has lifted the cost of living crisis to the top of the agenda. [L8N3090VQ]
Andersson's government has pledged 90 billion crowns ($8.4 billion) in compensation to households and companies for sky-high energy prices while the right also has plans to soften the blow in the short term and build more nuclear reactors.
Sweden and Finland applied to join NATO following Russia's invasion of Ukraine in a move backed by nearly all parties after the Social Democrats dropped their 73-year opposition, removing the issue from the election agenda.
WHAT HAPPENS AFTER THE VOTE?
As Sweden contends with multiple crises - the Ukraine war, soaring inflation and energy costs, and rapidly greening the economy - any government will be looked to for stability, something which may be in short supply even after election day.
For the Social Democrats, the challenge will be to reconcile the conflicting demands of its centre-left bloc.
The bloc includes the formerly Communist Left Party, whose leader demands a seat in government, and the centre-right Centre Party, which has ruled out supporting a cabinet that includes the Left or negotiating budgets with them.
On the right, the picture is equally uncertain.
The Liberals have ruled out backing a government that includes the Sweden Democrats, who in turn have demanded influence over policy commensurate with their size in a written agreement, unless they are invited into cabinet.
The Social Democrats must find common ground with parties holding conflicting ideas in areas like taxation and energy while the right faces similar obstacles, such as Moderate plans for unemployment benefit cuts, a move rejected by the Sweden Democrats.
Once political pariahs, the Sweden Democrats have tracked a course into the right-wing political mainstream, though they remain an anathema to the centre-left, and polls suggest they could become bigger than Kristersson's Moderates.
This would be unlikely to propel Sweden Democrats leader Akesson to the premiership given the reluctance of the other right-wing parties, but it would be more difficult to exclude him from government and leave Kristersson in a weak position to negotiate policy.
It took about 130 days to form a new government after the 2018 elections and while this time it should be quicker, given the Sweden Democrats are now more firmly in the right-wing camp, negotiations are still expected to be long and hard.
"It's not obvious which parties would contribute to a government, even if that party's bloc won a majority in parliament," said Nicholas Aylott, associate professor at Sodertorn University.
"That complicates things and might take some time to resolve."
(Reporting by Niklas Pollard; additional reporting by Johan Ahlander in Gothenburg and Ilze Filks for TV, editing by Ed Osmond)