Sweden's mainstream parties have reached a deal that will allow the minority centre-left government to remain in office and sideline the anti-immigration Sweden Democrats, who hold the balance of power in parliament.

Sweden's normally stable politics were thrown into turmoil in December when prime minister Stefan Lofven said he would call a snap election in March after his budget was voted down by the centre-right opposition and the Sweden Democrats. The deal means he will have to follow the opposition's budget next year, although he can make some changes in spring.