Sweden's Prime Minister and leader of the Social democrat party Stefan Lofven speaks at an election party at the Fargfabriken art hall in Stockholm, Sweden September 9, 2018. TT News Agency/Claudio Bresciani/via REUTERS

STOCKHOLM (Reuters) - Sweden’s Social Democrat Prime Minister Stefan Lofven said early on Monday he would remain in office in the coming weeks and called for cooperation across the political divide after an election which showed the country heading for a hung parliament.

“We have two weeks left until parliament opens. I will work on calmly, as prime minister, respecting voters and the Swedish electoral system,” Lofven told a party rally.

Lofven has led a minority government of Social Democrats and Greens, with Left Party support in parliament, for the past four years. The bloc held a wafer-thin lead over the center-right Alliance with less than 50 of 6,004 districts still to be counted.

Sunday’s vote, as expected, showed gains by the unaligned anti-immigration Sweden Democrats, leaving both the center-left and opposition center-right party blocs short of a majority.