Swedish Social Democrat leader Stefan Lofven faces a tough task in building a new government after an election on Sunday left the center-left short of a majority in parliament and handed the balance of power to a party that wants to slash immigration.

Prime Minister Fredrik Reinfeldt and his center-right coalition government, in power for eight years, will hand in their resignation on Monday after garnering fewer seats in parliament than the center-left opposition.

The far right anti-immigration Sweden Democrats emerged as the third biggest party, winning 12.9 percent of the vote. Despite holding the balance of power, other parties have refused to work with them.

“Sweden is waking up to a new political landscape,” Robert Bergqvist, chief economist at SEB said in an analysis. “Political authority and stability will be determined by the potential for informal cross-bloc cooperation and by inter-party agreements and resolve to isolate the Sweden Democrats.”

Lofven, a former welder and trade union negotiator, said late on Sunday he would begin coalition talks with the Greens but also reach out to others.

The center-left Social Democrat, Green and Left opposition - not currently a formal bloc - took 158 seats in parliament, short of the 175 needed for a majority.

A minority left-of-center government with an anti-immigration party that usually votes with the right-leaning parties holding the balance of power would be a unique parliamentary situation in Sweden. It is likely to have limited clout to pass bills and could even result in political deadlock.

Lofven hopes to entice members of the outgoing four-party center-right Alliance to cooperate with him. They have so far ruled out such a move but that may change in the face of the strong performance by the Sweden Democrats.

“It has never been this difficult to conduct an election analysis after a parliamentary election,” Jesper Bengtsson of the left-leaning think-tank Tiden said in an analysis. “The new government's task will be to meet the concern and fear that is reflected in the support for the Sweden Democrats... It's about seriously tackling social divisions and thinking in new and bigger terms about ambitions for integration policy.”

Independent liberal daily paper Dagens Nyheter said the Sweden Democrats could regularly vote down bills by a Social Democrat-led government. It also said it would be difficult for center-right parties to cooperate with the new government after they flatly refused before the election to do so.