As Europe awaited Swedish election results that balanced on a knife's edge, some were asking: How did this happen?
In Sweden, a bastion of tolerance, a nationalist and anti-immigrant party is on the cusp of joining a right-wing coalition in government.
A look at the party's origins and trajectory provides some answers.
What is the current state of election results?
On Sunday, Sweden held nationwide elections for its legislature, the Riksdag.
With 100% of the vote now counted, the Social Democrats have received the largest percentage of votes at 30.3%.
The Sweden Democrats are the second-strongest party, gaining 20.5% of the vote in their best-ever election performance. That makes them the biggest party on the right, in front of the Moderates who came as a close third with 19.1%.
Exit polls Sunday night initially indicated victory for the Social Democrats' center-left coalition, which has been in power since 2014.
But as vote-counting progressed, the right-wing bloc consisting of the Liberals, Christian Democrats, Moderates and Sweden Democrats gained 49.5% of the vote.
The left-wing coalition has 48.8% of the vote. Social Democrat Prime Minister Magdalena Andersson has already conceded defeat.
What is the origin of the Sweden Democrats?
Founded in 1988, the Sweden Democrats unified various elements in Sweden's far-right milieu, including fascists and white power proponents. "Some of them also had ties to openly neo-Nazi movements," said Johan Martinsson, a political science professor at Sweden's University of Gothenburg.
Around the mid-90s, however, new party leadership publicly denounced Nazism.
"Gradually, the party began to normalize and ban outright racism," explained Martinsson, who has written an extensive paper on the party. Openly extremist members were ejected, and its platform reshaped.
But according to Bulent Kenes, a persecuted former editor of a Turkish newspaper who has been living in Sweden since seeking asylum since 2016, "They keep a hidden agenda." He believes the party merely put a compassionate face on its neo-Nazi ideology in order to make it more socially acceptable.
A fresh face in party leadership
In 2005, current party leader Jimmie Akesson came to head the group. Only 26 at the time, the former member of the Moderate party pushed the Sweden Democrat's image away from its far-right roots, taking it in more of a populist direction.
Paralleling other right-populist movements, the party sought to portray itself as "advocating for 'ordinary people' against a corrupt elite at the height of a global recession," wrote scholar Danielle Lee Tomson in a paper on the rise of the Sweden Democrats.
As part of its push to project a gentler image, the party's logo was also changed: from the Swedish flag embodied as a flaming torch to the pennywort flower in flag colors of yellow and blue.
The party made its debut in the Riksdag in 2010 when it gained almost 6% of the vote.
But it struggled to gain traction and was considered a pariah in coalition-building.
That changed after the migration crisis of 2015.
Sweden Democrats go mainstream
Due largely to the civil war in Syria, Europe was faced with a wave of largely Muslim refugees in 2015. Over the course of one year, 1.3 million people fled to Europe; Sweden took in some 163,000 asylum-seekers (Germany took in around 1 million).
Sweden that year saw the second-highest number of asylum applications per capita in Europe, after Hungary.
Political scientist Martinsson sees this as a major factor in the party gaining traction.
"The main reason for the party's success in the last decade has been Sweden's uniquely high number of asylum-seekers and unusually rapidly changing demographics in terms of ethnicity and the share of foreign-born citizens," he told DW in an interview from Gothenburg.
With immigration as a top topic in both the 2014 and 2018 elections in Sweden, the Sweden Democrats capitalized on this concern.
Turkish journalist Kenes, who has extensively profiled the party, said its defense of "Swedishness" brings results.
"Especially undereducated people feel a threat from the cheap labor of immigrants," he said. "They think [the governing] Social Democrats are not representing their interests anymore."
Increasingly visible criminal violence and gang activity are also playing a role in the rise of the Sweden Democrats.
The party more than doubled its position in the 2014 election, gaining around 13% of votes. In 2018, that share became 18%.
When the center-right Moderates agreed to cooperate with the Sweden Democrats in 2019, this set the stage for eventual entrance to governing.
Caught off guard by current surge
"It is surprising for me to see them as the second-biggest party in the elections," Kenes told DW, as the Sweden Democrats had lost ground during the pandemic as voters turned more toward established parties.
Speaking from Stockholm, he said that aside from the immigration issue, the economic effects of COVID-19 and Russia's invasion of Ukraine have played a part in boosting the party's popularity, particularly among the working class.
He doesn't believe that all Sweden Democrat voters share the party's nationalist ideology but are rather "reacting to inflation and economic deterioration."
What do the Sweden Democrats stand for?
As for political scientist Martinsson, he defines the Sweden Democrats as "mainly an anti-immigration party with a nationalist ideology" but shies away from describing it as extreme- or radical-right.
"In economic terms, the party is more centrist and pragmatic, with a mixture of left- and right-wing proposals," Martinsson said.
Journalist Kenes, however, remains convinced that the party is a threat to democracy.
He points to a recent review indicating that 214 Sweden Democrat candidates who stood in the latest elections can be linked to right-wing extremism.
The Sweden Democrats aim for zero asylum-seekers, along with longer prison sentences and wider use of deportation. The party also has a euroskeptic stance.
"Sweden has been a great country, a safe country, a successful country — and it can be all these things again," Politico reported Akesson as saying during a rally in Helsingborg earlier this month.
"It's time to give us a chance to make Sweden great again," he was quoted as saying.
Edited by: Kate Hairsine