Denmark's likely next prime minister, Social Democrat Mette Frederiksen, faces tough negotiations in the coming weeks to form a minority government backed by parties with conflicting demands on climate, economic and immigration policy.
The opposition Social Democrats won Wednesday's general election as expected, ousting Liberal Prime Minister Lars Lokke Rasmussen's minority government after several of his key allies suffered scathing losses at the polls, including the anti-immigrant Danish People's Party which saw its score more than halved to 8.7 per cent.
The Social Democrats emerged as the biggest party with 25.9 per cent of votes and have adopted much of the far-right's hardline ideology and rhetoric on immigration, like most other parties in Denmark, pulling the rug out from under the far-right.
The Social Democrats and three other left-wing parties now hold a majority of 91 of 179 seats in parliament, while the right-wing won 79.
But Ms Frederiksen has indicated she hopes to build a single-party government - common in Denmark under its system of proportional representation - that would rely on other parties on the left and right for support depending on the issue.

Denmark's outgoing prime minister Lars Lokke Rasmussen as he leaves Amalienborg Castle, where he announced to the Queen that his government will resign. Source: AAP
She is expected to want to collaborate with the right-wing on immigration, and with the left on most other issues.
But her left-wing allies are expected to pressure her heavily to accept their conflicting demands in exchange for their support.
"There will be intense negotiations ... on the conditions for allowing Mette Frederiksen to become prime minister," University of Roskilde political scientist Flemming Juul Christiansen told AFP.
She "will now have to demonstrate whether she has the shoulders of a stateswoman, capable of rising above old conflicts to seize the opportunity voters have given the centre-left," the centre-left daily Politiken wrote in an editorial, predicting "a war of nerves".
Rune Stubager, a political scientist from Aarhus University, ruled out the possibility of a grand coalition.
"The distrust on both sides is too high."
Climate tops concerns
The left-wing parties were swift to set their terms.
One of their top demands, and one of voters main concerns, was aggressive action on climate.
"We want an ambitious climate policy," the head of the main green party, the Socialist People's Party, Pia Olsen Dyhr, said on election night.

Ballots being counted after the polling stations closed in Copenhagen City Hall during the final day of the parliamentary elections in Denmark. Source: AAP
Her party was one of the big winners on Wednesday, clinching 7.7 per cent of votes, up from 4.2 per cent in 2015.
And the Red-Green Alliance, which won 6.9 per cent of votes, warned: "To form a government with our support, we want a new direction for the welfare state and the climate."
Ms Frederiksen can also expect thorny dealings with another key ally.
The centrist Social-Liberal Party - the Social Democrats biggest ally with 8.6 per cent of votes - is opposed to the Social Democrats' tough stance on immigration and has differing views on economic policy.
Ms Frederiksen said after her election victory that the Social Democrats wanted "to negotiate broadly."
"Several parties are seeking a constructive cooperation."