STOCKHOLM, Sept 14 (Reuters) - Sweden's Social Democrat prime minister, Magdalena Andersson, accepted defeat on Wednesday after a close-fought election, handing the four-party right-wing opposition bloc victory and first go at forming a new government.
A handful of votes remain to be counted, but Andersson, who became Sweden's first woman prime minister last year, said the results showed the right bloc had won.
"In parliament, they have a one or two seat advantage," Andersson told a news conference. "It's a thin majority, but it is a majority."
Andersson said she would ask the speaker of parliament on Thursday to relieve her of her duties as prime minister.
Ulf Kristersson, leader of the Moderate Party, is the right's candidate to be prime minister.
"I will now start the work of forming a new government that can get things done, a government for all of Sweden and all citizens," Kristersson told reporters.
The Moderates, Sweden Democrats, Christian Democrats and Liberals had held a one-seat lead after Sunday's election but looked like getting 176 seats in the 349-seat parliament to the centre-left's 173 seats, according to the latest figures from the election authority.
The result still has to be officially confirmed, probably by the weekend.
The election marks a watershed in Swedish politics with the anti-immigration Sweden Democrats, shunned by all the major parties when they first entered parliament in 2010, on the threshold of gaining influence over government policy.
Andersson said she understood that many Swedes were worried a party with roots in the white-supremacist fringe was now the country's second biggest party.
"I see you concern and I share it", she said.
The Sweden Democrats look set to win 20.6% of the vote, overtaking the Moderates, who got 19.1%, as the biggest party on the right.
Though Kristersson's party is smaller, Sweden Democrat leader Jimmie Akesson cannot get the broad backing from the right needed to oust the Social Democrats.
Commanding only a thin majority, Kristersson faces a number of challenges.
Sweden, in the midst of a cost-of-living crisis, could be heading for recession next year.
The war in Ukraine has destabilised the Baltic region - Sweden's backyard - and uncertainty remains over whether Turkey will finally agree to Stockholm's application for NATO membership.
Measures to address climate change and long term energy policy also need to be thrashed out while holes in the welfare system exposed by the pandemic need to be plugged and a planned surge in defence spending financed.