Sweden Democrats Party members react to exit polls after the election in Stockholm, Sweden, on September 9, 2018.Ints Kalnins / Reuters

STOCKHOLM—It wasn’t quite the populist surge that the experts predicted. But in Sweden’s election on Sunday, the anti-immigration Sweden Democrats still managed to expand their influence, setting the stage for an uncertain government-formation process among the country’s eight political parties. After a tense and unusually divisive campaign focusing on immigration and crime, Sweden will now contend with a fractured landscape in which the center-right and center-left coalitions that have defined its politics for decades are deadlocked, and the populist party holds the balance of power in parliament.

While the center-left Social Democrats and the center-right Moderate Party, Sweden’s two dominant political entities, came in first and second with 28.4 percent and 19.8 percent, respectively, both parties saw a decline in their share of the vote on Sunday. Meanwhile, the Sweden Democrats’ third-place result with 17.6 percent, up from 12.9 percent in the previous elections, will allow it to play kingmaker in the next parliament.

A third-place finish is likely a disappointment for the Sweden Democrats: Preelection polls suggested they would become the country’s second-largest party. But the populists’ steady growth has exposed cracks in Swedish society. Aided by the fallout of Europe’s refugee crisis and a wave of violent crime, the Sweden Democrats have amplified their nationalistic message. While issues such as education, health care, climate change, and taxes played a central role in the election, the Sweden Democrats kept immigration in the spotlight, arguing that the high influx of migrants endangered the future of the country’s welfare state. Jimmie Åkesson, the party’s well-coiffed leader, called for halting virtually all immigration, restricting family reunification, speeding up deportations, and cracking down on the recent crime wave, which has been partly linked to immigrant gangs. Such rhetoric broke political taboos in Sweden.

“It’s important to note that Sweden is still a safe place to live, but you also need to compare Sweden to Sweden and these problems are new to us,” Paulina Neuding, the editor in chief of the political magazine Kvartal, told me. “These divisions are tough for a consensus-oriented country like ours. They’re creating a rift in society that won’t be going away.”

Sunday’s vote kicked off a new era in Swedish politics, one of weak government and a fragmented legislature. Because of Sweden’s multiparty bloc system, government formation requires political compromises and coalition building. But the Sweden Democrats’ strong showing injects considerable uncertainty into what has long been one of the world’s most stable democracies.

Because of the Sweden Democrats’ neo-Nazi and white-supremacist roots, mainstream parties have deliberately frozen them out of important negotiations and avoided seeking their support on key votes. But that won’t be so easy now. While both the outgoing government bloc led by the Social Democrats and the opposition bloc led by the Moderate Party pledged not to work with the Sweden Democrats after the election, the populist party still holds considerable influence. A wide array of multiparty coalitions on the left and right appear possible, but in most scenarios, forming a government and passing a budget will be tough without some modicum of support from the Sweden Democrats.

All of this means that it may be impossible to continue ignoring the Sweden Democrats. With Åkesson vowing to use his party’s newfound weight to obstruct any government that fails to take into account his party’s views on immigration, it is “a dilemma for the mainstream parties,” Anders Sannerstedt, an expert on the Sweden Democrats at Lund University, told me. “There’s an expectation to be pragmatic once the election ends. But [the Sweden Democrats] are still hated by many Swedes and negotiating with them could backfire.”

While much of the coverage of the campaign focused, with good reason, on the rise of the populist right, the decline of the mainstream parties is an equally important story line. The next prime minister will likely come from the Social Democrats or the Moderates, but both parties underperformed compared to 2014, losing supporters to the Sweden Democrats and smaller factions like the Center and Left Parties. Sweden’s center-left government led by the Social Democrats followed its predecessor’s open-borders policy, and has accepted 300,000 refugees and migrants since 2015. This opened the door for the Sweden Democrats and helped the populists brand themselves as the country’s only legitimate anti-immigration voice. The government later instituted measures to limit the number of new arrivals, citing risks to public order and national security.

But it was too late: The Sweden Democrats had already capitalized on the refugee crisis, painting the mainstream as out of touch and too hesitant to confront the consequences of large-scale immigration. “In the discussions we were having three or four years ago, there was such a strong feeling from some politicians about saying that kind of stuff legitimizes [the Sweden Democrats],” Johan Forssell, a member of parliament from the center-right Moderate Party, told me ahead of the election. “The outcome of that idea is that things boiled over and support for them rose.”

In many ways, the Sweden Democrats have already left their mark. During the election, the tone on immigration and integration shifted considerably for the largest political parties, from talk of openness and kindness in previous years to tough-on-crime rhetoric and a focus on identity politics. The Social Democrats promised to make studying Swedish compulsory for claiming benefits, and to reduce the number of refugees entering the country by half. The Moderate Party also tacked right, promising extra spending on police, while criticizing foreigners living off government benefits and not learning Swedish. In the home stretch of the campaign, both parties also challenged the Sweden Democrats more directly in a move to highlight the party’s inexperience, its controversial past, and support for unpopular ideas, like holding a referendum to take Sweden out of the European Union.

“People felt that we didn’t take [the Sweden Democrats] seriously and that helped present us as a party of the establishment, which maybe was a mistake,” Johan Hassel, the international secretary from the center-left Social Democrats, told me in the final days of the campaign. “But we’ve also been talking about their racist roots, and I think that is right.”

Now the Sweden Democrats must decide how to use their expanded influence. They have positioned themselves as the country’s true opposition and only voice willing to speak the truth about the alleged dangers of mass immigration and multiculturalism. But their growth is also the result of Åkesson’s efforts. Since taking over in 2005, he has tried to detoxify the Sweden Democrats and led them from the fringe into parliament in 2010. He has instituted a zero-tolerance policy on racism within the party ranks and pushed a doctrine of cultural nationalism that welcomes foreigners who learn Swedish and accept the culture. The rebrand hasn’t always worked, however: Several members have been kicked out or were placed under investigation during the campaign for allegations of racism, anti-Semitism, and Islamophobia.

In the months ahead, the Sweden Democrats’ leaders will want to show their critics in parliament that their party can be responsible and mature. But too much compromise also risks alienating their base. “Sweden is not a winner-takes-all democracy. We know we will have to compromise and we’re open to show others that we can work with them,” Paula Bieler, a lawmaker from the Sweden Democrats, told me ahead of Sunday’s vote. “We will also need to have at least some of our propositions met, especially on migration and integration.”

But as the conversation now shifts to political horse-trading, an angrier and more divided Sweden will need to come to terms with this unique political moment. “We’ve already lost so much time. It’s been 20 years of not having an honest conversation about migration and integration,” Mustafa Panshiri, an author and former police officer who immigrated to Sweden from Afghanistan as a child, told me. “Perhaps this election can make it so we can have a more open discussion in the future. But the cost has been this devastating polarization of society.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.