TROLLHATTAN, Sweden -- The southern industrial city of Trollhattan has become a focal point for Sweden's underlying racial tensions, which contrast with the nation's generous attitudes to migrants.

On Thursday, a 21-year-old local man rampaged through a school in the city, stabbing two people to death and seriously wounding two others before being fatally shot by police. Authorities called it a racist hate crime, saying he methodically selected dark-skinned victims at Trollhattan's Kronan school, where most students are foreign-born.

The attacker, who killed a teacher and a student, has not been named by police.

Many in this nation of 10 million were horrified by the violence but not surprised at its eruption, since the surge of refugees into Europe has increased anti-immigrant attitudes. Swedish immigration officials estimate some 190,000 asylum-seekers will arrive this year, second only to Germany in Western Europe.

A teacher at a school near Kronan, Jo-Anne Frampton, told The Associated Press that the school attack in Trollhattan was "just a matter of time."

Sweden has also seen a spate of arson attacks on asylum centres or buildings being fitted to house refugees. Early Saturday, another blaze -- considered by investigators again to be arson -- destroyed a house intended for refugees in Eskiltuna, near Stockholm.

"Once again, we have experienced a hate crime ... Our country is burning. Asylum dwellings are in flames," commentator Erica Treijs wrote Saturday in an editorial in Svenska Dagbladet, one of Sweden's largest newspapers. "The hatred against immigrants spreads like wildfire."

Trollhattan used to be Sweden's busiest industrial city, a centre for heavy industries and car production, but it has been struggling with unemployment for years. Over one-sixth of its 56,000 people are foreign-born and it now has Sweden's highest jobless rate -- 14.1 per cent in 2014 compared to 8 per cent for the nation.

Arson is not a new weapon for those in Sweden who don't want immigrants to come in. In 1993, an arson attack destroyed the mosque in Trollhattan. The present mosque was built on the same ground.