Danish Prime Minister Mette Frederiksen's Social Democrats appeared headed for their worst election outcome in over a century, as migration and welfare concerns obscured broad support for her defiant stance toward the US over Greenland.
In power since 2019, Ms Frederiksen, 48, had campaigned on a promise that her tough and tested leadership skills would help the Nordic nation navigate a complex relationship with US President Donald Trump and the European response to Russia's war in Ukraine.
However, she emerged bruised both from the left and the right at home, where the cost-of-living crisis has come to the front of voter concerns, observers said.
Ms Frederiksen's Social Democrats, the architects of its cradle-to-grave welfare state, were seen winning 38 seats in the legislature, the Folketing, compared with 50 four years earlier.
Projections by local media showed the left-wing bloc slightly ahead of its right-wing rivals, though falling short of an outright majority.
If final results confirm the close outcome, Ms Frederiksen might struggle to stay in power for a third term and negotiations over who gets to form the government could take days or weeks.
Many of her left-wing supporters appeared frustrated with an immigration policy they saw as too tough, while some on the right saw her too soft and untrustworthy on economic issues.
"She is between a rock and a hard place because the numbers are bad for her," said Andreas Thyrring, a partner at Ulveman & Borsting public affairs advisory firm.
In Brussels, Ms Frederiksen is widely respected for her clear line on Greenland and for her efforts to ramp up Denmark's defence spending in the wake of the Ukraine conflict.
But her negotiating style is seen by some as abrasive and many Danes sought change.
The vote was also being closely watched in Greenland, with many hoping it will be a chance for the territory to leverage Mr Trump's unprecedented desire to wield control over the Arctic island to wrangle concessions from its former colonial power in Copenhagen.
Underscoring the broad backlash against Ms Frederiksen, support for the anti-immigration Danish People's Party, led by Morten Messerschmidt, surged to 9.1% with more than 90% of votes counted by public broadcaster DR, up nearly 7 percentage points compared to the last election.
Mr Messerschmidt had campaigned on a pledge to ensure zero net migration of Muslims and abolishing petrol taxes as a measure to ease living costs.
"The fact that the Danish People's Party has now tripled its support clearly shows that Danes are fed up with this and that there are a great many people who want a different direction for Denmark," Mr Messerschmidt said after exit polls were published.