COPENHAGEN, Denmark (AP) — In Scandinavia, there's a new type of socially conscious liberal - that wants tighter restrictions on immigration.
Left-wing parties in Denmark and Sweden that historically defended humanitarian values and generous welfare systems have shifted positions since Europe saw an influx of migrants that peaked in 2015.
The transformation is serving them well.
Denmark's Social Democratic Party won a June 5 general election after embracing restrictive immigration policies. The pragmatic tactic returned the party to its anti-migrant roots after two decades of relatively more liberal policies.
"The Social Democrats have basically placed themselves where they see the majority of voters," political scientist Karina Kosiara-Pedersen, an associate professor at Copenhagen University, said.
Now, political operatives far beyond Denmark are asking if that is "the cure that other Social Democratic parties can turn to?" she said.
The 41-year-old leader who guided the party's transformation, Mette Frederiksen, is expected to be Denmark's next prime minister. As the opposition during the past four years, Social Democratic lawmakers almost always voted with the right-wing governing party's majority on restrictive immigration measures.
To form a minority government that can get plans through parliament, though, Frederiksen had to back away from some hard-line immigration proposals to win support from three other left-wing parties.
Across Europe, the surge of over 1 million refugees and economic migrants that arrived in 2015 prompted a populist backlash that gave a huge boost to anti-migrant parties and drained votes from mainstream parties, particularly left-wing parties with welcoming migration policies.
Many newcomers from Africa, Asia and the Mideast headed to wealthy nations in northern Europe with generous taxpayer-supported welfare systems.
Denmark's Social Democrats concluded it was impossible to preserve both the Danish welfare provisions and to support large numbers of refugees
"We must reduce the number of those who come, to protect our welfare state, the wonderful benefits we have built through generations," said Marina Christensen, 39, a civil servant in Copenhagen who voted for the Social Democrats.
Another party supporter, Casper K. Prien, said he wants controls on migration but opposes the anti-Muslim rhetoric of the anti-migrant Danish People's Party.
"The Social Democrats want to remain tough on immigration but with a human face," the 67-year-old retiree said.
But others see an erosion of humanitarian values.
The Social Democrats supported the so-called "jewelry law" of 2016 that allowed Danish authorities to seize jewelry and other assets of refugees to help finance their housing and other services. The law was denounced by human rights groups, though in practice it has been implemented only a handful of times.
They also voted last year to put rejected asylum-seekers and foreigners convicted of crimes on a tiny island that formerly housed facilities for researching contagious animal diseases.
However, this week's four-party agreement that paved the way for Frederiksen to become Denmark's youngest prime minister included dropping the plan for the island of Lindholm.
Some commentators are dismayed by the anti-migrant turns of progressive parties, believing that it normalizes the heartless treatment of people fleeing war.
Germany's Die Welt newspaper wrote that the German Social Democrats could only dream of the result their Danish brethren got in the June election but called the embrace of right-wing immigration views "a dangerous turn."
Stefan Lehne, a political expert with the Carnegie Europe think tank, believes the circumstances across the European Union's 28 nations are so different in each place that one cannot conclude that Denmark's center-left Social Democrats have found a universal key to survival.
Lehne notes that some parties in Europe with relatively liberal positions on migration have actually been winning elections as the influx of migrants has slowed significantly in the last few years and climate change becomes the key issue of the day, among them Prime Minister Pedro Sánchez's Socialists in Spain. Meanwhile, some right-wing parties have done poorly recently despite their tough anti-immigrant platforms, including the conservative Christian Social Union in the German state of Bavaria.
Yet even with its stricter stance against migrants, Denmark's Social Democrats actually only gained one seat in the 179-seat parliament compared to the 2015 election.
In Sweden, which neighbors Denmark, the Social Democrats also won power last year after shifting to the right amid a surge in support for a populist anti-immigrant party.
David Crouch, author of the upcoming book "Almost Perfekt: How Sweden Works and What We Can Learn From It," says both the center-right and the center-left in Sweden are using tougher language on crime as migration into the country has slowed.
Social Democratic Prime Minister Stefan Lofven threatened to deploy the Swedish army to end a wave of gang violence and party leaders now say it was a mistake for Sweden to take tens of thousands of migrants in 2015. There have also been high-profile cases of children being threatened with separation from migrant parents or business people threatened with deportation.
"The Social Democrats have been keen to send a message that Sweden is not an easy place to receive asylum," Crouch said, adding that in both Sweden and Denmark, anti-migrant parties might not win elections "but their politics live on in the shape of the Social Democrats."
Still, the latest political solution from Scandinavia may not translate well across the Atlantic.
In the United States, as parties gear up for the 2020 election, some have suggested the Democrats should take a harder line on immigration to steal away votes from the Republican Party and President Donald Trump, whose tough talk about halting immigration and building a border wall with Mexico energizes his right-wing populist base.
But Lehne says Latinos and other minorities who traditionally support Democratic candidates in the U.S. would see that as xenophobic.
"It would be suicidal for them to be anti-migration," Lehne said. "It's out of the question."