The rise of the far-right Sweden Democrats to become the country’s second-largest party, with a claim to government, has been a slow-moving earthquake over the past decade. But even as their success in Sunday’s election seemed inevitable, it still had the ability to shock.

The world still regards Sweden as a bedrock of Nordic liberalism, and its move toward the more populist right, based on grievances about crime, migration, identity and globalization — and the way they affect health care, schools and taxes — has been slower than in other countries. So the election’s result was something of a wake-up call.

"Sweden is very much an activist and ideologically charged nation, and in part because we had such an idyllic 20th century, we thought we could afford it,” said Robert Dalsjo, director of studies at the Swedish Defense Research Agency. "So the popular discontent over globalization and migration and crime we saw in Trump took longer to leak itself through the protective structures of the establishment here.”