STOCKHOLM (Reuters) - Swedish political parties face weeks of haggling to form a government after voters delivered a hung parliament on Sunday, with the anti-immigration Sweden Democrats saying they hold the balance of power.

Front pages of Swedish newspapers are seen a day after day after the general election, in Stockholm, Sweden, September 10, 2018. TT News Agency/Hanna Franzen via REUTERS

A preliminary allocation of parliamentary seats gave the center-left bloc - uniting the minority governing Social Democrat and Green parties with the Left Party - 144 seats versus 143 for the center-right Alliance bloc.

The Sweden Democrats, who want to leave the European Union, won 62 seats, up from 49 in the 349-seat Riksdag where 175 seats are needed to form a majority.

Doing a deal with them would give either bloc a majority but the mainstream parties have ruled out cooperating with a party which has roots in the white supremacist fringe.

Both blocs have declared themselves victors in the election, but need additional support to form a viable government without the Sweden Democrats, who want influence over immigration policy.

There are a number of ways out of the tangle.

Election results graphic: tmsnrt.rs/2CDMT4e

CENTER-RIGHT MINORITY RULE

The Alliance of the Moderates, Centre, Liberals and Christian Democrats looks set to be slightly smaller than the center-left. But it will hope for backing from the Sweden Democrats to oust Prime Minister Stefan Lofven and to install Moderate leader Ulf Kristersson as his replacement.

However, a formal agreement with the Sweden Democrats would very likely see the Centre and Liberal parties, who want looser immigration policies, jump ship.

It is not clear whether the Centre and Liberal parties would take part in a government that had no formal support from the Sweden Democrats but in practice relied on their votes to install a prime minister.

On Monday, Sweden Democrats leader Jimmie Akesson invited the Moderates and Christian Democrats to formal negotiations but was quickly rebuffed.

Akesson said his party would vote against any government that did not give it a say in policy.

SOCIAL DEMOCRATS AND GREENS CLING ON

The Social Democrats and Greens could retain power in the unlikely event that Prime Minister Lofven survives a mandatory vote on whether to replace him.

Lofven said he would remain in office in the coming weeks and called for cooperation across the political divide.

When voting for a prime minister in parliament, a proposal is passed unless a majority of all 349 lawmakers vote against. This has allowed minority governments to rule.

The Alliance would need the Sweden Democrats to back a vote to oust Lofven and install Kristersson.

A GRAND COALITION

The Alliance could join a grand coalition with the Social Democrats and possibly the Greens to exclude the Sweden Democrats. The Left Party, Sweden’s former Communist party, would also be left out.

But the Moderates - the biggest party in the Alliance - are not interested in cooperating with the Social Democrats and such a deal would also raise questions about democratic accountability. Voters might see the Sweden Democrats as the country’s only opposition party.

MODERATE ONE-PARTY RULE

The Moderates could form a one-party government but that would require support from the Sweden Democrats as well as the smaller center-right parties.

Moderate leader Kristersson has ruled this out, and the Centre and Liberal parties would probably not go along with the idea if the Sweden Democrats were given any significant say over policy while remaining outside the government.

NEW VOTE

Parliament opens on Sept. 25. If Lofven is ousted, the speaker is allowed to give a maximum of four prime ministerial candidates the opportunity to form a government. If they all fail, fresh elections must be called. There is no formal time limit for negotiations, but the deadline for the budget is Nov. 15.

If no new government is in place by then, the current government, continuing as caretakers, would put forward a budget until a new cabinet can take office.