Europe's once-powerful Social Democratic parties have been losing steam for decades, a trend that continued in the recent European Parliament elections. In Germany, the party's leader quit after particularly terrible results.
But in Denmark, the Social Democrats are holding their own and appear poised to take back the reins of government after Wednesday's national election.
What's their secret?
The last time Danes voted in parliamentary elections, in 2015, Europe's migration crisis was at a boiling point. Support for the populist, anti-immigrant Danish People's Party surged to 21%, a few percentage points behind the Social Democrats, but enough to help carry the current center-right coalition into power.
Many voters supporting the Danish People's Party were former Social Democrats. On taking over as the Social Democrats' new leader shortly thereafter, Mette Frederiksen gave a hint of what was to come: "I know that many Danes are worried about the future," she said. "Worried about jobs, about open borders. About whether we can find a balance in immigration policy."
In 2015, about 21,000 migrants sought asylum in Denmark, a number that has fallen dramatically every year since. But Denmark's demographics have been changing for decades. According to government figures, in 1980 about 1% of Danish residents were of "non-Western background," compared with 8.5% today.
Within months of the 2015 election, Frederiksen was expressing more specific thoughts on migration. "In my eyes, it is neither heroic nor humane to bring so many people here that the problems become huge in our own country," she said in an interview on Denmark's TV2. "Because we're not very good at integrating in Denmark, and there's nothing to indicate that we're going to get better."
Since then, Denmark's Social Democrats have tacked hard right on immigration. Working closely with colleagues across the aisle in Parliament, they passed laws aimed at sending — or keeping — refugees to their home countries, rather than integrating them.
Their platform includes a "Marshall Plan" for Africa, intended to stem the flow of migration by improving conditions at the source. But Social Democratic party members have also played a part in headline-grabbing initiatives more commonly associated with hardliners, like a law allowing police to seize jewelry and other assets from refugees, a burqa ban and a plan to put certain rejected asylum-seekers on an island previously used for infectious disease research.
It's a strategy that has worked inasmuch as it has lured voters back from the right and kept the party afloat. Largely as a result of the Social Democrats' success in this area, the Danish People's Party is in free fall, now with just 9% of the vote. (The party has also been hurt by the launch of two other parties that are even more anti-immigrant, though they remain relatively small).
But the Social Democrats' success has come at a price.
While the party's immigration strategy has brought many right-leaning voters back into the fold, it has also sent others fleeing further left. In fact, the Social Democrats' 26% plurality in this week's election is a pinch less than what the party won in 2015.
Frederiksen is now in a strong position to become the country's next prime minister, thanks to the explosive growth of the three smaller parties in her left-wing bloc, whose votes she will need to form a government.
Those parties have expressed support for the idea of Frederiksen as Denmark's next leader, but their backing hinges on obtaining a variety of concessions. Among them: more investment in childcare programs, a stronger commitment to the environment, changes in some economic policies and — especially — a softening of the Social Democrats' stance on immigration.
One party in particular, the Social Liberals, is in a position to make or break a future left-wing government with its demands. Though the party actually falls at the very center of the country's political spectrum, it has managed to position itself as the antidote to right-wing populism: It is pro-immigration, pro-Europe and pro-environment.
While the Social Liberals' stated priority is to be part of a center-left government, leader Morten Østergaard appeared lukewarm on election night, saying, "There are many possible ways to form a parliamentary majority after this election. ... I feel obligated to give Mette a chance, and I've said for months that we'll do that, but it depends on how much the political course changes."
What will follow now is a series of inter-party negotiations that political scientists say could go on for days or even weeks.
"Rhetorically the two sides are really juxtaposed at the moment, each in their corner of the ring, and saying we're not going to move at all," says Aarhus University political scientist Rune Stubager. "It will be potentially a very long poker game."
Stubager predicts that the Social Democrats will fight to maintain voter credibility by holding the "main lines" on immigration — presumably some version of the current stance — while softening "bits and pieces" with broad support. "But then, of course, the question is what constitutes the main lines, and what are the bits and pieces that may be changed, and that's unclear," he says.
Should discord within the left bloc prove too great to overcome, the outgoing center-right prime minister has extended the option of a grand coalition across the center line, which would be an unprecedented development in Danish politics.
Until then, conservative leaders say they'll fill the popcorn bowl, sit back and watch. No doubt Europe's Social Democrats will be doing the same.