Denmark’s nationalists had their worst drubbing in Wednesday’s election, leading to a new political landscape with a left-leaning government led by its youngest prime minister.
Mette Frederiksen, 41, who leads the Social Democrats, won the election after her political bloc promised more welfare paid for by higher taxes that will partly come from the financial industry.
She faces long talks to form a government but will be her country's second female prime minister.
Ms Frederiksen stands out in Social Democratic history for having agreed to tougher rules on foreign labour, although without stigmatising Muslims in the same way the nationalists have done.
The anti-immigration Danish People’s Party's disastrous result means the centre-right coalition of prime minister Lars Lokke Rasmussen has lost the parliamentary support it needed to stay in office.
Mr Rasmussen conceded defeat shortly before midnight. He told broadcaster TV2 he would hand in his resignation to Denmark’s queen on Thursday, after Ms Frederiksen won majority backing in the Parliament.
The opposition leader “should have the chance to form a new government", he said.
Everything now points toward “a regime shift in Danish politics”, said Helge Pedersen, chief economist at Nordea Bank in Copenhagen.
The result suggests that voters have had enough of the ultra-hard line Danish People’s Party.
Even Mr Rasmussen signalled that he found some of Denmark’s immigration laws too severe after recently revealing that his son's Harvard-educated American fiancee was unable to stay in the country.
The Danish People’s Party, which was formed in 1995, was by far the biggest loser in Wednesday’s vote as its support was more than halved.
It was backed by more than a fifth of the electorate in 2015, giving it the political mandate to push through a hardline agenda against immigration.
That year Europeans wondered how their continent could take in hundreds of thousands of asylum seekers from the war in Syria.
But now, Danes are less worried about asylum seekers and more concerned about issues that the Danish People’s Party has failed to embrace, such as the environment.
Its founder, Pia Kjaersgaard, drew ridicule recently after blaming “climate loonies” for her party’s changed fate.
Kristian Thulesen Dahl, head of the Danish People’s Party, described the election result as a thrashing.
Mr Dahl blamed the emergence of other new right-wing parties for the result, saying they lured voters away.
One of those parties, Hard Line led by convicted racist Rasmus Paludan, was set to just miss the 2 per cent threshold needed to get into parliament.
Another, the New Right, was set to make it into the legislature by a slim margin.
Although immigration was less of vote winner than in previous years, it continues to be an important issue for Danes, particularly blue-collar workers worried about competition from migrants.
“It is becoming increasingly clear that the price of unregulated globalisation, mass immigration and the free movement of labour is paid for by the lower classes,” Ms Frederiksen said in a recent biography.
Her approach to immigration has led to friction within the group of left-leaning parties that have traditionally backed the Social Democrats, meaning she faces a tougher set of government talks than usually would follow a Danish election.
Ms Frederiksen made clear that she wanted to rule an administration comprised only of the Social Democrats, with the parliamentary backing of her political allies on the left.
But those parties have indicated they will be making their own demands, including a more humane approach toward immigrants.
“It will be difficult to form a coalition government, or a government at all, because there are disagreements within what we call the Red Bloc parties,” said Prof Bent Greve of Roskilde University.
Mr Rasmussen, 55, has recently announced that he is ready to break away from his coalition partners and the Danish People’s Party.
He said that could include forming a government with the Social Democrats.
But Ms Frederiksen was quick to dismiss such an alliance. suggesting that she would stick with her traditional allies on the left.