The United States ranked No. 7 on the list, with Norway slightly ahead at No. 6.

More than 21,000 people participated in the survey and were asked questions about economic stability, job market and income equality. U.S. News also based the score how much in remittances immigrants are able to send to their country of origin, what percentage of the population are immigrants and the United Nations assessment of integration for immigrants, such as language training and transfers of job certifications.

Sweden has received a growing number of refugees from North Africa, but its refugee policy was not a factor in determining the rankings. Immigration policy was taken into account.

"While our methodology did not focus on refugees specifically, it did take into account immigration policies and integration measures per analysis from the United Nations," said U.S. News data reporter Deidre McPhillips, according to The Washington Post. "Our aim with this package was to focus on the economic aspects of immigration and the impacts this could have on a country's perceived standing in the world."

But Sweden, a small country with a population about the size of New York City, has been questioning the longevity of its generous social welfare programs with the growing influx of immigrants from Africa and the Middle East, as well as Eastern Europe.

"Sweden has had to come to terms with the limits of its policies [toward migrants]," said Demetrios G. Papademetriou, a senior fellow and president emeritus at the Migration Policy Institute in Washington D.C.

And with more people with different ways of life coming into a mostly homogeneous society, tensions have risen in recent years, especially after a recent attack by an asylum seeker from Uzbekistan plowed a beer truck into a crowd and killed four people in April.

"It is out of control. There is a lot of them, there is no place for them," a Swedish resident who is the son of Greek immigrants told CNN. "The real problem is the refugees. They come here and think they can do whatever they want."

But even before the beer truck attack, Sweden had been clamping down on immigration by limiting "the possibilities for asylum seekers and their family members to be granted residence permits in Sweden" and denying social welfare benefits, including housing, if the asylum-seeker has been denied.