Indeed, the relentless stream of migrants to Europe — propelled by the war in Syria and turmoil across the Middle East and the Horn of Africa — has combined with economic troubles and rising fear of Islamic radicalism to fuel a backlash against immigrants, directed most viciously at Muslims.
The simmering resentments and suspicions have driven debates across Europe about tighter controls on immigration. Worries about immigration have helped buoy right-wing parties in Britain, Denmark, France and Hungary. German officials recorded more than 70 attacks against mosques from 2012 to 2014, including an arson, and the police in Britain have recorded an increase in hate crimes against Muslims. There are few places where the turn against immigrants is more surprising than Sweden, where a solid core of citizens still supports the 65-year-old open door policy toward immigrants facing hardship that has long earned international respect for the country.
On Friday, hundreds of Swedes gathered outside the royal palace in Stockholm and in other cities to show solidarity with the Muslim population a day after an unknown assailant threw a bottle filled with flammable liquid at a mosque in the northern city of Uppsala and sprayed racist slogans on the building. The firebomb caused no injuries and did not damage the building.
But as each day brings more reports of immigrants who have boarded ships and sneaked across European borders, the famous tolerance of the Swedes is being tested as never before.
Despite a lackluster economy, Sweden was third behind only Germany and France in the number of people registering for asylum in 2012, according to the Migration Policy Institute in Washington. Relative to its population, Sweden received the second-highest share of asylum applications in the European Union after Malta, the institute says.
Opposition to the rising numbers is growing. The far-right, anti-immigrant Sweden Democrats had their best showing ever — nearly 13 percent of votes — in elections in September.
The entry of the Sweden Democrats to parliament in 2010 had already opened the door for a previously unthinkable discussion about turning back the country’s policy of taking in foreigners on humanitarian grounds and granting them access to the country’s generous welfare system.
Adrian Groglopo, a professor of social science at the University of Gothenburg, has studied discrimination in Sweden over the past decade. He said that Sweden has long been a racially segregated country where many immigrants live in ghettos and struggle to find jobs, but that the success of the Sweden Democrats has made racism more socially acceptable.
“It is a very difficult time in Sweden,” Dr. Groglopo said. “Now we can talk about things that we weren’t allowed to talk about before. It is a kind of coup d’état.”
Last month, the Sweden Democrats threatened to bring down Prime Minister Stefan Lofven’s minority government. Early elections were averted only through a last-minute deal that observers say granted the anti-immigrant party even more power by pulling it from the sidelines and making it the primary opposition.
The party’s growth has occurred despite the fact that roughly a fifth of Sweden’s 9.6 million people were born abroad or to immigrant parents in Sweden. Most immigrants here have access to education, but government figures show a disproportionate unemployment rate for them, more than twice the national rate of about 8 percent. The disparity helped fuel riots in immigrant neighborhoods outside Stockholm in 2013.
In Germany, another anti-immigrant movement is underway. In recent weeks, a group calling itself the Patriotic Europeans Against the Islamization of the West has attracted as many as 17,500 people to rallies that demand stifling of immigration. The group has called for more rallies on Monday, in Dresden and Cologne.
Omar Mustafa, president of the Islamic Association of Sweden, which represents about 40 communities across the country, said the recent fires at mosques were the culmination of a year of rising anti-Islamic attacks, from women having their hijabs, or head coverings, pulled off in the streets to the vandalism of 14 mosques, as well as racist or anti-Muslim vitriol spread through social media.
“It is a scary development in Swedish society,” Mr. Mustafa said by telephone. “It is a big movement that is moving from the Internet to the real world.”
Vandals broke windows in the mosque in Eskilstuna twice last year and twice in 2013. But Mr. Warsame, the imam, said the mosque — located in a ground-floor storefront in a residential area of largely immigrants — had good relationships with its neighbors and the city officials.
When people nearby complained about the disturbance of comings and goings for late-night prayers during Ramadan, Mr. Warsame and the leaders of two other mosques with similar problems sought out a remote location for their holiday ritual.
No arrests have been made in the Christmas Day blaze that gutted the mosque in Eskilstuna, or the Dec. 29 fire at a mosque in Eskov or the attack in Uppsala. In response, the national police have tightened security at mosques and other religious buildings across the country.
The fire in Eskilstuna prompted an outpouring of support for the congregation, including an event in which dozens of people pasted handmade, heart-shaped notes to the boarded-up windows of the mosque in what they called a “love bomb.” The event was organized by an activist group known as Tillsammans for Eskilstuna, or Together for Eskilstuna. Despite the support, members of the mosque said they remained rattled.
Mr. Samantar, who is originally from Somalia, said he struggles to get through his prayers without smelling smoke or hearing the rush of a fire. After he escaped that day, he said, he feared that women and children were trapped in other rooms of the burning building, and anxiety haunts him still, even in his sleep.
“We would always take our families with us to the mosque,” said Mr. Samantar, a father of three. “The mosque was always our safe place. It’s not anymore.”