COPENHAGEN -- Denmark's centre-right prime minister resigned Thursday after a general election that ended with a gain for left-leaning parties and a big loss for populists who were supporting the government.

Prime Minister Lars Loekke Rasmussen's resignation leaves the centre-left Social Democrats, Denmark's largest party, to start talks to form a one-party minority government.

Social Democrat leader Mette Frederiksen had rejected forming a coalition with Loekke Rasmussen's Liberals.

Loekke Rasmussen failed to maintain a majority in parliament after his allies, the populist Danish People's Party, saw their vote share plunge to 8.7% in Wednesday's election from 21.1% in 2015.

Rune Stubager, a politics professor at Denmark's University of Aarhus, said that the election results showed a "considerable swing to the left" on the topics of welfare and climate.

The Social Democrats are promising to put welfare first again and reverse some of centre-right government's cuts. But they also say they will seek support from the right on immigration issues, and that they will continue the current government's tough anti-immigration stance.

Pressed by his populist supporters, Loekke Rasmussen's government has tightened immigration laws in recent years. Face-covering garments have been banned, and newly arrived asylum-seekers are required to hand over valuables such as jewelry and gold to help pay for their stays.

Last year, Denmark made international headlines when officials decided that rejected asylum-seekers or those with a criminal record awaiting expulsion should be sent to an island that once housed a defunct laboratory for contagious animal diseases.

Stubager called the election outcome "a disaster" for the populists because voters are dissatisfied that the protest party now "is part of the political establishment."

Like their counterparts in neighbouring Sweden, Denmark's Social Democrats have opted for a tougher stance on immigration since the 2015 refugee crisis, when hundreds of thousands of asylum-seekers sought shelter in European countries. Sweden's Social Democratic government has sharply restricted immigration, reversing a long tradition of welcoming migrants and refugees.

On Thursday, Loekke Rasmussen formally handed over his resignation to Queen Margrethe, Denmark's figurehead monarch, at the Amalienborg Palace.

Talks to form a new government, expected to begin later Thursday, could take weeks.

Turnout in Wednesday's election was 85.5%, according to official figures, slightly lower than in the 2015 elections.