She marked her return on Facebook, with a video straight out of a Quentin Tarantino film, buttoning her jacket, arranging her hair and slipping on stiletto heels to heavy metal music. “I’m ready again,” she declared to camera. “Let’s get this bus rolling.”

Mette Frederiksen, leader of Denmark’s opposition Social Democrats, was in hospital with food poisoning when the prime minister, Lars Løkke Rasmussen, called a general election last week, and was two days late joining the campaign.

But the 41-year-old has all the momentum, with her left-of-centre bloc starting with an eight percentage point lead, and few doubting that she will become Denmark’s youngest-ever prime minister after the election on 5 June.

“I’m super excited because we so desperately need a change of government,” said campaign volunteer Malou Astrup Clemmensen as she prepared to hand out roses on the streets of Copenhagen for Frederiksen’s campaign launch.

A victory for Frederiksen would be a boon for Europe’s social democrats as they gaze across the continent at a dispiriting political landscape. But it would not be without controversy, for under Frederiksen the party has been ruthlessly reshaped: dragged to the left economically – and sharply to the right on immigration.

“For me, 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,” she said in a recent biography.

Denmark’s current right-wing coalition government last year enacted the most anti-immigration legislation in Danish history and, rather than position her party in stark opposition, Frederikson has embraced much of it.

Under her leadership, the SD have called for a cap on “non-western immigrants”, for asylum seekers to be expelled to a reception centre in North Africa, and for all immigrants to be forced to work 37 hours a week in exchange for benefits.

She has reached out to the populist Danish People’s party (DPP), doing a series of joint interviews with its leader, Kristian Thulesen Dahl, and discussing cooperating with them in government.

But it is the government policies her party has supported or failed to oppose which have been most alarming for her allies in the left-of-centre red bloc. The Social Democrats voted in favour of a law allowing jewellery to be stripped from refugees, and a burqa and niqab ban, and abstained rather than voted against a law on mandatory handshakes irrespective of religious sentiment at citizenship ceremonies, and a plan to house criminal asylum seekers on an island used for researching contagious animal diseases. In February, she backed what the DPP has branded a “paradigm shift” – a push to make repatriation, rather than integration, the goal of asylum policy.

“I find it odd that it’s possible to make such a shift, not just in your policy but also in your fundamental values,” Morton Østergaard, leader of the centrist Social Liberal party, told the Observer. “What’s different in Denmark is that we’re seeing parties coming out of a Liberal or Social Democrat value base eating into national conservatism in a race-to-the-bottom contest, because they’ve decided that the marginal voter can’t get tough enough on immigrants.”

Many believe her party’s new populist profile is a pure power play. The Danish People’s party has slipped from 21% in the 2015 elections to below 13%, according to a poll of polls by the Berlingske newspaper.

An internal Social Democrat survey of the party’s core voters carried out last autumn found that 37% of loyal Social Democrat voters thought immigration policy was too lax. And this was after three years of the most anti-immigration government in Danish history.

Frederiksen has dealt harshly with any internal dissent. When her party colleague Mette Gjerskov, a former minister, vociferously opposed the burqa ban, a rival candidate for her seat came forward at the same time as the local Social Democrat mayor suggested it might be time to change MP. Gjerskov fended off the challenge, but was then fired as the party’s international development spokesman.

“I was aware that shifting the position in the party would take a lot, but I knew that I had to win that fight,” Frederiksen said in the biography. “Normally, I would seek to compromise, but not on immigration policy.”

For the young campaigners in Copenhagen, the policy seemed to be an unpleasant necessity. “I’m not a fan of the burqa ban,” Clemmensen admitted. “But to me there has been too much focus on it, compared with the environment, growing inequality and the financial sector.”

Frederiksen has been promoting her approach as a prescription for ailing Social Democratic parties across the world, berating sister parties at a meeting in Lisbon last December for losing their core voters’ trust by failing to prevent globalisation chipping away at labour rights, increasing inequality, and exposing them to uncontrolled immigration.

“For years, we have underestimated the challenges of mass immigration,” she told them. “Economic policy and foreign policy in Europe have been too liberal. We have failed when it comes to maintaining the social contract, which is the very foundation of the social-democratic social model.”

Out on the Copenhagen streets, MP Peter Hummelgaard argued that the tough line on immigration was a return to the party’s roots. “We have become more aligned with many of the voters who we are made to represent, and who we became alienated from over the past 25 years,” he said.

In Tårnby, the working-class area he represents near Copenhagen airport, voters who deserted the party for the Danish People’s party are flooding back, he claimed. “The reactions that I’m meeting on the street are overwhelming. It is one of the areas where you have seen the consequences of mismanaged immigration, and you have also seen working-class people leaving the Social Democrat party. But they are now returning.”

• This article was amended on 13 and 14 May 2019: to change “anti-migrant” to “anti-immigration” in the headline; and to clarify details about the Social Democrats’ voting record and internal affairs.