Sweden's prime minister has resigned after her government was defeated in Sunday's election.
Magdalena Andersson's centre-left bloc lost narrowly to a bloc of right-wing parties, 176 seats to 173, with 99% of the votes counted.
Moderate Party leader Ulf Kristersson is now expected to form a government.
His right-wing grouping includes the Sweden Democrats, a far-right party that has campaigned against rising gang shootings.
It is a huge blow to Andersson's Social Democrats, which gained votes compared to the last election, and remain Sweden's largest party.
But in Sweden, it is bloc politics that usually decides who gets into power and the right bloc has scored a razor-thin majority.
The final result is still to be confirmed after a recount, which is standard practice in Sweden.
Ms Andersson accepted defeat at a news conference on Wednesday. She formally offered her resignation on Thursday.
"In parliament, they have a one or two seat advantage," she said. "It's a thin majority, but it is a majority."
The close-fought election campaign was dominated by gangs, immigration and integration issues, as well as soaring electricity prices.
Ms Andersson was the Nordic nation's first female PM when she took office last year - she quit on the first day, before returning soon after.
She has been edged out by a four-party right-wing block made up of the Sweden Democrats, Moderate Party, Christian Democrats and Liberals.
It is a momentous turning point for Swedish politics - the Sweden Democrats was once treated as a pariah by political parties, but has now won around 20% of the vote.
It vowed to "make Sweden safe again" by bringing in longer prison sentences and restricting immigration.
However the party's leader Jimmie Akesson will not become prime minister, because he does not have the support of the other right-wing parties to take on the job.
Instead, Ulf Kristersson, leader of the Moderates has said he will start work to form a government.
"I am ready to do all I can to form a new, stable and vigorous government for the whole of Sweden and all its citizens," he said on Wednesday.
It remains unclear whether Mr Kristersson's government will involve a coalition or formal cooperation with the Sweden Democrats. He has already held talks this week with the leaders of the Christian Democrats and Liberal parties as well as the nationalists.
The Sweden Democrats is a party born out of a neo-Nazi movement at the end of the 1980s, which has slowly grown stronger while attempting to polish its image.
Although many of its policies are right-wing, it sits to the left of some other parties in the bloc on some economic issues, such as protecting the current level of unemployment insurance.
It started off growing its support base among rural working class voters, but this has now broadened. This year it has almost doubled its support amongst first-time voters, with some 22% of 18-21-year-olds voting for the party according to Swedish Public Service broadcaster SVT's exit poll survey.
In 2019 Mr Kristersson started talks with the Sweden Democrats after years of declining to cooperate with them - a move which has now changed Sweden's political landscape.
Ms Andersson told reporters on Wednesday that she understood those concerned at the party's growing popularity. "I see your concern and I share it," she said.
Magdalena Andersson's Social Democrats had governed Sweden since 2014 and dominated the country's political landscape since the 1930s.
Sunday's vote was one of the closest elections ever in Sweden, with thousands of overseas and postal votes needed to be counted to get a clearer picture of who the winner was.