Magdalena Andersson: Sweden's PM resigns after conceding election to right-wing

Sweden's Social Democrat Prime Minister Magdalena Andersson has officially resigned from her post after she accepted defeat in a close-fought election.

Andersson handed victory to the four-party, right-wing opposition bloc, giving them the first go at forming a new government.

With 99% of the vote counted, only a handful of ballots remain unassigned. Andersson, who became Sweden's first woman PM only last year, said the results showed her opponents have won.

She handed in her resignation to the speaker of parliament on Thursday morning.

Although Andersson's Social Democrats emerged as the biggest single party after Sunday's vote, the other parties on the left didn't have a majority of seats overall.

The far-right anti-immigrant Sweden Democrats won the second biggest share of the vote, and will now seek to form a government with the conservative Moderates, Christian Democrats and Liberals, who between them have secured a slender three-seat majority in the Riksdag, the Swedish Parliament, with 176 seats to 173.

The result still has to be officially confirmed.

The election marks a watershed in Swedish politics with the Sweden Democrats -- shunned by all the major parties when they first entered parliament in 2010 -- on the threshold of gaining influence over government policy.

Sweden's next prime minister is likely to be Ulf Kristersson, the leader of the Moderates.

Although his party only finished in third place -- normally considered an embarrassment for the traditional biggest conservative party -- Kristersson will most probably become PM as the other parties in their new coalition do not want to see Sweden Democrats leader Jimmie Åkesson in the top job.

Åkesson said on Wednesday night his party would be "a constructive and driving force in this work” of rebuilding safety in Sweden, adding it was “time to put Sweden first”.

The election campaign in Sweden was dominated by energy prices and gang-related violence, but the four right-wing parties have differing views on a number of issues, including unemployment benefits and asylum law.

Negotiations to form a coalition are expected to last several days or even weeks, according to analysts.