STOCKHOLM (Reuters) - Neither of Sweden’s main political blocs is likely to win a majority in an election on Sunday, giving the far-right Sweden Democrats a key role in shaping the next government.

FILE PHOTO: Stefan Lofven, Swedish Prime Minister and leader of the Social Democrats, campaigns ahead of the Swedish general election in Uppsala, Sweden August 18, 2018. TT News Agency/Nils Petter Nilsson via REUTERS/File Photo

The center-left bloc, uniting the minority governing Social Democrat and Green parties with the Left Party, is backed by about 40 percent of voters, recent opinion polls show, a slim lead over the center-right Alliance bloc.

The Sweden Democrats, who oppose immigration and Sweden’s continued membership of the European Union, are polling around 18 percent of the vote and would thus hold the balance of power.

Doing a deal with them would give either bloc a majority. But all the mainstream parties have ruled out cooperating with a party which has roots in the white supremacist fringe, making forming a new government fraught with difficulty.

Parties are holding their cards close to their chests, but there are a number of options that could break the impasse.

CENTER-RIGHT MINORITY RULE

Although the Alliance of the Moderates, Centre, Liberals and Christian Democrats may be smaller than the center-left after the vote, it can probably rely on some kind of support from the Sweden Democrats to oust Prime Minister Stefan Lofven.

A center-right coalition government is seen as the most likely option by bookmakers.

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

The Sweden Democrats have been clear they want influence over policy, particularly on immigration, in return for support.

“We are prepared to bring down any government we think is not leading Sweden in the right direction,” Sweden Democrats leader Jimmie Akesson told Reuters in a July interview.

SOCIAL DEMOCRATS AND GREENS CLING ON

The Social Democrats and Greens could theoretically retain power if the center-left is the biggest bloc and in the unlikely event that Prime Minister Stefan Lofven survives a mandatory parliament vote after the election on whether to replace him.

When voting for a prime minister in parliament, a proposal is passed unless a majority of the Riksdag’s 349 MPs vote against. This has allowed minority governments to rule.

Lofven could survive if the Sweden Democrats decide not to back the Alliance in calling for a new prime minister in protest at the Alliance rejecting their policies.

He might also be able to continue if the Alliance’s Centre and Liberal parties abstain.

The Centre and Liberals have said they do not want to split the Alliance, but that they would look for some kind of cross-party arrangement if it ends up being smaller. Their decision is likely to be key, but they have deliberately avoided specifics.

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 probably 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.

SWEDEN DEMOCRATS BECOMING BIGGEST PARTY

The biggest party does not necessarily get to rule in Sweden. The Social Democrats were bigger than the Moderates from 2006-2014 when the Alliance governed.

Polls put the Sweden Democrats some way behind the 25 percent support the Social Democrats enjoy. But polls have underestimated support for Jimmie Akesson’s party in the past.

If the Sweden Democrats get top spot, that would put extra pressure on the other parties to either come to an agreement with each other to keep them out or to recognize that democratic legitimacy demands that Akesson’s party be given a say.

Both options would be divisive.

MODERATE ONE-PARTY RULE

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

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

NEW VOTE

The speaker of parliament has four goes at giving prime ministerial candidates a run at forming 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 care-takers, would put forward a budget until a new cabinet can take office.

(Graphic: Swedish opinion polls - tmsnrt.rs/2LmSZFD)