The Social Democrats emerged as Denmark's biggest party in elections Wednesday, with preliminary results indicating gains for left-leaning parties and a big loss for populists.
If confirmed in final returns, the outcome pointed to the Social Democrats returning to power after four years as the country's leading opposition party.
Liberal Prime Minister Lars Lokke Rasmussen, whose party has been in power for 14 of the past 18 years, conceded defeat after the Social Democrats emerged as the biggest party with 25.9 percent of votes, giving the left-wing bloc a majority of 91 of the 179 seats in parliament, the Folketing, with 100 percent of votes counted.
Rasmussen was on Thursday to hand in his to Queen Margrethe, the process of forming a new government will commence.
Mette Frederiksen, the party's leader, said late Wednesday that the Social Democrats will try to govern as a minority rather than form a governing coalition with smaller parties. It will seek support from the right on some issues, such as immigration, and from the left on other matters, such as social welfare, she said.
Although Frederiksen won't try to form a coalition, other left-leaning parties that increased their vote shares will likely support her effort to form a government to avoid the center-right from getting a chance. The Social Liberals and the Socialist People's Party both doubled their tally of seats, while the leftist Unity List dropped one. Frederiksen will face a challenge to secure agreement with them on immigration. Under her leadership, the Social Democrats have adopted a more restrictive stance more akin to Rasmussen's Liberals and the anti-immigration Danish People's Party.
The Liberal Party of Rasmussen showed a slight gain from four years ago. But the populist Danish People's Party, which often voted with the center-right Liberals, was hit with a big drop in support, meaning Loekke Rasmussen can no longer muster a majority in parliament with 75 in the parliament.
The Danish People's Party's performance was a contrast to some other European countries, where far-right populists have been on the rise. The party was the second-largest party in the outgoing parliament, but its vote share plunged to about 8.7% Wednesday, worst result since 1998, compared to 21.1% in 2015.
Rasmussen's junior partners, the Conservatives doubled their support, while support for the Liberal Alliance plunged. Party leader Anders Samuelsen, the foreign minister, lost his seat.
"You have chosen that Denmark should have a new majority, that Denmark should take a new direction," Frederiksen said told a jubilant crowd at parliament. "And you have chosen that Denmark should have a new government."
At age 41, Frederiksen could become Denmark's youngest-ever prime minister.
"The election campaign is now over. It's time to find solutions," she said.
Many Danish People's Party voters have drifted to the Social Democrats, mainly because of it readopting tough views on immigration. The party advocated restricting immigrants in the 1980s and 1990s but softened its position later while in a coalition with left-wing parties.
Its lawmakers voted for several laws introduced by Rasmussen's government to tighten immigration.
"This is really, really bad," People's Party leader Kristian Thulesen Dahl said of his loss at the polls, but he said the party would not change its politics and he wanted to continue as leader.
"I'm not abandoning ship in the middle of the storm, I take the responsibility to once again move the party forward," he said.
The Hardliner Course party didn't cross the 2% threshold needed to enter Parliament. The New Right, another openly anti-Muslim group that also fielded candidates for the first time, will be in the legislature after getting 2.4% of the votes.
The Social Democrats, last in power between 2011 and 2015, were widely seen as favorites going into the vote.
Led by Frederiksen -- a party veteran who made her debut in parliament at 24 -- the Social Democrats have also changed their tone on immigration.
In the early 2000s, she denounced Denmark's policy as one of the "toughest in Europe".
But under her leadership, the Social Democrats last year proposed, as part of their crackdown on immigration, to send asylum seekers to special camps in North Africa while their requests are processed.
With most parties in agreement on a tough immigration policy, and as Denmark enjoys robust growth, almost full employment and strong public finances, the Social Democrats focused their election campaign on climate issues and the defense of the welfare state, promising to reverse budget cuts to education and healthcare.
Frederiksen now faces lengthy negotiations in the weeks to come to secure support for her new government. Left-wing parties were swift to state their demands in exchange for their support.
"We want an ambitious climate policy," the head of the main green party, the Socialist People's Party, Pia Olsen Dyhr, said.
Her party was one of the election's big winners on Wednesday, clinching 7.7 percent of votes, up from 4.2 percent in 2015.
The left-wing parties "are going to put pressure on Mette Frederiksen on all fronts," conservative daily Jyllands-Posten wrote in an editorial.
According to a Gallup poll published in February, some 57 percent of Danes think the next government should prioritize climate change. For those aged between 18 and 35, the figure was 69 percent.
The Social Democrats are expected to cooperate with the right on immigration issues and with the left on other matters. But the Social Democrats could find it necessary to forge more lasting ties to find political stability, given the country's fragmented political landscape.
The Danish parliament, the Folketing, has 179 seats, four of which represent the autonomous territories of Greenland and the Faroe Islands, which have two seats each. Voter turnout, which is typically high, came in at 84.5 percent, just below the 85.9 percent from 2015.