Moderate leader Ulf Kristersson's big bet that a deal with the anti-immigration Sweden Democrats would make him prime minister looks likely to pay off, but squabbling allies, policy divisions and a cost-of-living crisis could make his tenure turbulent.
Kristersson's Moderates, the Sweden Democrats, the Christian Democrats and the Liberals hold a wafer-thin lead for the right after Sunday's election, although some votes have yet to be counted. That means the result could yet swing in favour of current Prime Minister Magdalena Andersson, whose Social Democrats are set to remain the largest party in parliament.
A preliminary result is expected later this week, but should the right win, as looks likely, it will be a watershed moment.
Kristersson would become prime minister, but the Sweden Democrats, with roots in the white supremacist fringe, will overtake his Moderates as the biggest right-wing party, making forming a government and framing policy a challenge.
"There is only one party that has won the election and that's the Sweden Democrats," said Ulrica Schenstrom, state secretary to former Moderate prime minister Fredrik Reinfeldt between 2006 and 2007 and now head of the Fores think tank.
"Clearly it is a very big challenge that the Sweden Democrats are now bigger than the Moderates."
With the right-wing vote split since the Sweden Democrats entered parliament in 2010, the Moderates faced semi-permanent opposition status unless Kristersson did a deal with Sweden Democrat leader Jimmie Akesson.
Kristersson hoped that by offering the Sweden Democrats a path into the mainstream, the Moderates could finally get a working majority for the right. That strategy may now have worked too well.
The Sweden Democrats look set to get around 21% of the vote to 19% for the Moderates after Sunday's election. No party except his own will support Akesson as prime minister, however.
That leaves Kristersson as the right's only candidate - some consolation for the 58-year-old, who was supplanted as head of the Moderates' youth wing by Reinfeldt, who went on to lead the party and become prime minister of a centrist and pro-immigration government.
Kristersson eventually succeeded Reinfeldt as party leader and spent years undoing that move to the middle, though a bid to become prime minister in the 2018 election came to nothing.
HARD TO SWALLOW
His task will not be easy. The right bloc has agreed to cooperate, but the details remain to be sorted out, including which parties would be in government, and a budget.
The Liberals and the Sweden Democrats disagree on many policies and refuse to cooperate in government or support a government that contains the other.
Kristersson, a former social security minister and father of three, also does not want the Sweden Democrats to join a government - but Akesson has demanded a seat in cabinet.
At the very least, the Sweden Democrats leader - who blames Sweden's ills on decades of overgenerous immigration polices and the failure to integrate "new Swedes" - wants an influence on policy that matches the party's size.
Akesson aims to make Sweden's immigration policies the European Union's toughest, making it possible to deny people asylum based on religious or LGBTQ grounds, and to pay for tax cuts by slashing overseas aid.
The Liberals, who backed the Social Democrats in 2018 before changing their minds, will find these policies hard to swallow.
"The Liberals have been absolutely tortured about how to deal with the Sweden Democrats," Nicholas Aylott, associate professor of political science at Sodertorn University, said.
On the other side of the equation, Moderate and Christian Democrat plans to cut unemployment benefits to pay for tax cuts are opposed by the Sweden Democrats, whose economic policies are more aligned with the centre-left.
Akesson told Reuters before the election he would make sure a Kristersson government did not shift "too far right" on welfare and benefits.
The loose, centre-left bloc comprising Andersson's Social Democrats, the Centre, Left and Greens meanwhile agrees on little except that the Sweden Democrats must be kept from having a direct influence on policy.
With three of the four right parties starved of power for eight years and Akesson keen to burnish his credentials as a future prime minister, Kristersson may well find the necessary compromises in the short term.
But maintaining unity in the face of challenges further ahead will be a major test.
The energy crisis, Sweden's bid for NATO membership, inflation, climate change and the war in Ukraine, are all issues that must be dealt with, former Centre Party leader Maud Olofsson told Swedish public broadcaster SVT.
Olofsson was deputy prime minister in Reinfeldt's government between 2006 and 2010, but her centre-right party switched sides in 2018 under new leader Annie Loof to keep the Sweden Democrats from power.
"I am genuinely worried that we won't get a government that can run the country," she said.