Image copyright AFP Image caption Stefan Lofven waved as he and his wife Ulla arrived at the Swedish parliament on Tuesday

Sweden's centre-left prime minister, Stefan Lofven, will have to stand down after losing the support of parliament.

The anti-immigration Sweden Democrats (SD) backed the vote to remove him, weeks after a general election that delivered a hung parliament.

Mr Lofven was opposed by 204 MPs, with 142 voting in favour.

The parliamentary speaker will now propose a new prime minister, with centre-right leader Ulf Kristersson seen as the most likely candidate.

Mr Lofven is expected to stay on as caretaker prime minister while his replacement is decided, in a process that could take weeks.

What happens next?

Mr Lofven, the leader of the Social Democrats, came to power in 2014.

In this month's election, his centre-left bloc won 144 seats, one more than the centre-right bloc led by Mr Kristersson.

Neither of the blocs intends to govern with the SD, the third-largest party in the new parliament with 62 seats.

A member of Mr Kristersson's Moderate party, Andreas Norlen, was confirmed as the parliament's new speaker on Monday, with the support of SD.

The splintered nature of the house makes securing a stable government tricky because:

Mr Lofven's party has ruled out backing a centre-right minority government

Two of the four members of the centre-right bloc say they will quit if it negotiates a deal with the SD

If there are four unsuccessful attempts to form a government, that will trigger fresh elections - something which has never happened before.

'No man's land' - Swedish media reaction

By Matilda Welin, BBC Monitoring

Most Swedish news media are providing live commentary on an unprecedented moment in Swedish politics.

The main bone of contention is whether the blocs can stomach supporting each other, or if they will seek support from the Sweden Democrats - something several party leaders have promised never to do.

"Now, Sweden enters no man's land", said the liberal daily Dagens Nyheter. "The situation is locked…Sweden will never get a government unless one or more party leaders can break their promises."

The issue risks ripping previous allies apart. "The government formation may destroy the Alliance from within", said Public Service's political commentator Mats Knutsson.

A new interpretation of the constitution has taken effect for this election, which only adds to the uncertainty. "Now comes something that can be compared to parliamentary driving in the dark", said Sweden's biggest daily, Svenska Dagbladet.

"Nobody wants to back down, nobody is showing any willingness to compromise, everyone wants it in a way that benefits them the most", prominent commentator Lena Mellin said in tabloid Aftonbladet. "Where are all the adults in the room? Not in parliament, that's for sure."

What has the fallout been?

Speaking after the vote, Mr Lofven, who is still the leader of the largest party, said he intended to work to form another government across the political divide.

"I see good opportunities to continue as prime minister," he said.

Mr Lofven said he did not believe that fresh elections were something voters wanted but he added that he would never support a government that relied on the SD.

Mr Kristersson said that a new government was needed - one with broad political support.

While the SD is expected to back the Moderate candidate, Mr Lofven warned the centre-right bloc on Tuesday against relying on the support of a party "founded by Nazis".

Who makes up the rival blocs?

Mr Lofven's Social Democrats stood for election as part of a coalition with the Green Party.

The radical Left Party won 28 seats. While it did not join Mr Lofven's government, it did provide parliamentary support.

The centre-right bloc is made up of Mr Kristersson's Moderates and three other parties: the Centre Party, the Christian Democrats and the Liberals.

Who are the Sweden Democrats?

The SD is a nationalist, anti-immigration party which was linked to neo-Nazis and other far-right groups for years. It only entered parliament in 2010.

In the years since, it has become the third-largest party - a political success story.

Officially, it welcomes supporters from all backgrounds but its history means it has been shunned by the mainstream political parties since it first won seats.

Image copyright Getty Images Image caption Jimmie Akesson, leader of the SD, on the campaign trail with the party's floral logo

The SD has been keen to change its image but there have been some scandals, and several party members have been expelled in recent years for racist behaviour or links to right-wing groups.

Traditionally, its supporters have been working-class men.

But the party won 18% of the vote in the recent general election - up from 13% four years ago - demonstrating a growing base in Sweden.