(CNN)The leader of Denmark's center-left Social Democratic party, 41-year-old Mette Frederiksen, is on course to become the country's youngest Prime Minister, after an election that inflicted deep losses on the country's far-right.
Far-right populists suffer big losses in Denmark's election
Frederiksen adopted a hardline stance on immigration during the election campaign, luring voters away from the right-wing populist Danish People's Party (DPP).
While far-right parties have made gains in other European countries, the DPP saw its share of the vote dip by half on Wednesday.
Under Frederiksen, the Social Democrats have supported some of the most aggressive anti-immigrant laws in Europe put forward by the current center-right government.
The center-left grouping, which Frederiksen's party leads, is projected to win 45 seats in the Danish parliament, the Folketing, in Wednesday's election, according to national broadcaster DR.
That tally beats the 37 seats won by the three-party center-right bloc led by Prime Minister Lars Lokke Rasmussen of the center-right Venstre party, putting Frederiksen's Social Democrats in position to take power.
In this prosperous nation -- normally associated with its egalitarianism and a high position in various global well-being rankings -- immigration and the welfare state were key issues ahead of Wednesday's vote.
But climate change also punched through as the biggest concern with voters, especially among millennials, Kristian Madsen, a political analyst at the Politiken newspaper, told CNN.
"It was a non-issue in the last election and has come creeping in, really, in the last couple of months," Madsen said, adding that it reflects the healthy state of Denmark, which is enjoying strong public finances, growth and record high public employment.
"If we had a 10% unemployment rate or refugee crisis" like the one in 2015, the priorities would have been different, he added.
DR's exit poll was based on 4,550 voters across 40 polling stations.
After four years in opposition, the resurgence of the Social Democrats has been credited to Frederiksen tacking left on socio-economic issues -- by promises to boost welfare spending and tackle climate issues -- while shifting right on immigration.
By "co-opting the populist right, she is attempting to steal their voter base," Madsen told CNN prior to the exit poll's release.
This legislation includes a controversial law banning face coverings, a moratorium on accepting a UN refugee resettlement quota, and plans for so-called "ghetto laws" targeting disadvantaged areas where more than half the inhabitants originate from non-Western countries.
Wednesday's apparent results marked a stunning collapse for a party which swept into second place during the 2015 elections, and was credited for transforming Danish politics with its anti-establishment and anti-immigrant message over the last several decades.
"Many of these popular right voters, who have supported DPP for the last 20 years, are turning their backs on them," Kasper M. Hansen, a political science professor at the University of Copenhagen, told CNN, referring to the voters flocking to the Social Democrats or to a new crop of smaller far right parties.
"What we are witnessing here is a really interesting experiment for European center-left parties," Madsen added.
Pending collaboration with other parties in the red bloc (the traditional name for the center-left grouping), the Social Democrat party looks set to take the majority in parliament after what may be several weeks of tough negotiations.
"The big question is whether or how easily they will get to that position because all the parties in the red bloc want policy concessions," Rune Stubager, a political scientist at Aarhus University, told CNN.
The Social Democrats may have won back some of the traditional working class vote, but it was also predicted to lose a cohort of liberal voters, who are opposed to its hardline immigrant stance, Madsen said.
That played out on Wednesday. Both the Socialist People's Party, which focused on environmental issues, and the Social Liberal Party almost doubled their vote compared to 2015.
Taking a hardline position on immigration may be a 'recipe for success" in the parliamentary election, but the Social Democrats have another hurdle: it will now have to "square the circle with [left wing] parties who want a different policy on immigration," Stubager said.