Mette Frederiksen’s Social Democrats suffered their worst result in a century in elections on Tuesday, as her Left-wing bloc failed to secure a majority.

As of early Wednesday morning, with 99 per cent of votes counted, the Danish prime minister’s party won nearly 22 per cent of the vote and will remain as the largest party in the Folketing, Denmark’s parliament.

But both her Left-wing bloc and the parliament’s Right-wing bloc failed to secure a majority, opening the door to lengthy and complex coalition talks.

It means that Lars Lokke Rasmussen, the leader of the centrist Moderates party, is set to become a kingmaker in the upcoming discussions on forming the next government.

Zenia Stampe and Samira Nawa of Radikale Venstre (the Social Liberal Party) celebrate in Copenhagen

Zenia Stampe and Samira Nawa of Radikale Venstre (the Social Liberal Party) celebrate in Copenhagen – EPA

It is expected that several weeks of coalition talks will now take place, which may end in Ms Frederiksen forming a centrist coalition and serving a third term.

While it was a bruising night for the political centre, the hard-Left and populist Right made gains in the elections, with the Right-wing populist Denmark Democrats winning 9.1 per cent of the vote.

Ms Frederiksen called the snap election to capitalise on a surge in public support in Denmark for her tough stance on Donald Trump, who has repeatedly threatened to invade the Danish territory of Greenland.

Peter Kofod, an MP for the Danish People's Party, celebrates a surge for his party

Peter Kofod, an MP for the Danish People’s Party, celebrates a surge for his party – EPA

At the height of the Greenland crisis last January, Mr Trump appeared to be poised to use military action to take the territory, which he said the US needed for national security reasons.

Although Mr Trump later backed down, pivoting to negotiations with Denmark on how to resolve America’s security guarantees, Ms Frederiksen warned that the issue had “not gone away”.

As Danes headed to the polls on Tuesday, the prime minister of Greenland said it was facing the “most important election” in the island’s history.

It was a good night for Pia Olsen Dyhr, the chairwoman of the Left-wing Socialist People's Party

It was a good night for Pia Olsen Dyhr, the chairwoman of the Left-wing Socialist People’s Party – EPA

“We are in a time where we have a superpower trying to acquire us, take us, control us,” Jens-Frederik Nielsen told AFP news agency. “I think it’s the most important election for the Danish parliament in Greenland in history.”

As an autonomous Danish territory, Greenland has two seats in the 179-seat Folketing, which are also being contested in this election.

However, as all Denmark’s political parties oppose a US takeover of Greenland, the campaign has largely been fought over migration, taxes, the cost of living, drinking water quality and animal rights.

Mette Frederiksen's tough stance on the territory was expected to help her win the snap election

Mette Frederiksen’s tough stance on Greenland was expected to help her win the snap election – Henning Bagger/EPA/Shutterstock

Perhaps the most controversial policy of the election was a wealth tax proposed by the Social Democrats to cover the costs of keeping class sizes down to 14 children.

Critics from the Right-wing Liberal Alliance party warned that the tax – 0.5 per cent on assets worth more than 25m Danish kroner (£2.9m) – would trigger a mass exodus of talent from Denmark. Niels Christiansen, the head of Lego, also said it would drain Denmark’s capital and have a chilling effect on job creation.

Another key issue has been the presence of nitrates and pesticides in Danish drinking water, as well as a debate on the impact of industrial pig farming on the environment and animal welfare.

As voting got under way on Tuesday, the populist Denmark Democrats launched a last-ditch bid to win votes by paying for petrol, with its rising cost having been a key element of their campaign. As part of an agreement with the Danish petrol station Go’on, the price of fuel was lowered for several hours, with the Denmark Democrats paying the difference.

Polling day got off to an odd start for one Danish politician, the education minister Mattias Tesfaye. He posted an image on Instagram which showed that his dog, Mango, had eaten his polling card.

Try full access to The Telegraph free today. Unlock their award-winning website and essential news app, plus useful tools and expert guides for your money, health and holidays.