IN 1965 SWEDEN’S Social Democratic Party embarked on the Million Programme, an ambitious plan to build a million new homes in a country of only 7.7m people. These homes had everything that good democratic citizens could want—all mod cons, easy access to public services and green spaces.

The government exceeded its target by 6,000, but in other respects the Million Programme went awry. Swedish workers quickly showed what they thought of the new homes—many of them high-rise blocks of flats on the edge of cities—by skedaddling at the first opportunity. In the 1980s the Million homes were filled by guest workers from the Balkans and Greece. Today, as the guest workers skedaddle in turn, they are being filled by refugees from the world’s trouble spots.

Rosengard was once one of the programme’s proudest achievements: a high-rise development that was close to the centre of Malmö, one of Sweden’s industrial powerhouses, but surrounded by open space. Today over 80% of its population of 24,000 are immigrants. The local shops have names such as Babylon and Lebanon. Women in hijabs and headscarves cart their shopping through the freezing rain. Men sit in cafés drinking strong coffee and keeping dry. A truck sells falafel sandwiches.

The Swedish state does its best to reach out to these immigrants. The city of Malmö’s crest is everywhere. The local library has a language café and a chess room. A sports complex includes a swimming pool and a boxing ring. People in red jackets marked “Rosengard hosts”—most of them immigrants themselves—help residents negotiate the complexities of the welfare state.

Yet the relationship between the state and its clients is strained. “In Sweden having a job is everything,” says Tobias Billstrom, the minister for immigration and a former MP for Malmö; but in Rosengard only 38% of the residents have one. Angry youths have taken to rioting, torching bicycle sheds and recycling centres as well as cars.

Per Brinkemo is a former journalist whose life was changed when he wrote a book about a Somali boy who was brought up in war-torn Mogadishu. He now runs an organisation that specialises in helping Somali refugees from the basement of a Rosengard block of flats. The centre’s walls are decorated with pictures of high-ranking visitors and prizes awarded to Mr Brinkemo. But he is no fan of government policies, pointing out that politicians have little sense of how difficult it is to integrate Somalis into Swedish society. They hail from nomadic societies where trust is reserved for the clan, literacy is rare and timekeeping is rudimentary. Three-quarters of Somali children drop out of school. “For Somali immigrants [coming to Sweden] is like being transported to Mars,” he says.

The sums that don’t add up

Mass immigration is posing serious problems for the region. For the Nordic countries to be able to afford their welfare states they need to have 80% of their adults in the workforce, but labour-force participation among non-European immigrants is much lower than that. In Sweden only 51% of non-Europeans have a job, compared with over 84% of native Swedes. The Nordic countries need to persuade their citizens that they are getting a good return on their taxes, but mass immigration is creating a class of people who are permanently dependent on the state.

Torben Tranaes, of Denmark’s Rockwool Foundation Research Unit, calculates that in the mid-1990s immigrants in their 40s—the age group that generally contributes most to the public budget—paid only marginally more in taxes than they received in benefits. In Sweden 26% of all prisoners, and 50% of prisoners serving more than five years, are foreigners. Some 46% of the jobless are non-Europeans, and 40% of non-Europeans are classified as poor, compared with only 10% of native Swedes. Immigrants are so closely associated with the Million Programme, and hence with public housing, that the Gringo, a Stockholm newspaper for immigrants, calls them Miljonsvenskar, or “Million Swedes”.

High immigration is threatening the principle of redistribution that is at the heart of the welfare state. Income inequalities in the Nordic countries are generally lower than elsewhere (see chart), but Matz Dahlberg, of Uppsala University, reckons that immigration is making people less willing to support redistribution. The decline is particularly marked among high-income earners. Immigration is also causing culture clashes. Nordics fervently believe in liberal values, especially sexual equality and freedom of speech, but many of the immigrants come from countries where men and women are segregated and criticising the prophet Muhammad is a serious offence. Peaceful Denmark found itself on the front-line of the culture wars when Jyllands-Posten, a newspaper, published cartoons making fun of Muhammad.

Immigration has divided the Nordics. The Swedes regard their open-armed approach to asylum-seekers as an expression of what is best in their culture. The Danes revisited their immigration policies in 1999, spurred by the rise of the anti-immigrant Danish People’s Party. They tightened the rules for family reunification, made it more difficult for newcomers to claim benefits and set up an integration ministry. Today Denmark receives more non-European immigrants than ever, but it has radically reduced the number of refugees while increasing the number of people on student and work visas. The biggest battle is within the Nordic mind. Is it more progressive to open the door to refugees and risk overextending the welfare state, or to close the door and leave them to languish in danger zones? Is it more enlightened to impose secular values on devout Muslims or to dilute liberal values in the name of multiculturalism? Trying to reconcile these contradictions can lead to strange results. Alarmed by reports of female genital mutilation, Nyamko Sabuni, a Swedish cabinet minister, suggested compulsory gynaecological examinations for all young girls in Sweden. Liberals are increasingly on the defensive. The number of immigration-related attacks is rising. In 2010 Taimour Abdulwahab al-Abdaly blew himself up in the middle of a crowd of Christmas shoppers in central Stockholm; remarkably, he managed to injure only a couple of people. In Sweden median household incomes of non-European immigrants are now 36% lower than for native-born Swedes, whereas in 1991 they were only 21% lower. But Denmark’s much-vilified immigration reforms may be paying off: the employment gap between native Danes and non-Western immigrants has declined to 24 percentage points, compared with 42 in the mid-1990s. Sweden is now allowing in more skilled workers, having previously combined highly restrictive policies for this group with the world’s most generous policies for refugees. Trade unions used to have a veto over who was admitted and repeatedly used it. This may calm the immigration debate, but it may equally well increase the pressure to open the doors even wider for skilled immigrants while closing them for refugees.

A 20-minute drive from Rosengard to the western harbour takes the visitor to the Turning Torso, a high-rise, high-spec block that twists like a lithe athlete and commands spectacular views over the Oresund bridge linking Malmö to Copenhagen. Directly opposite its entrance is an establishment calling itself a “facelift centre”. Designer houses cluster around its base. Green’s supermarket sells local organic food and advertises yoga classes and tango lessons on the beach.

Thirty years ago Malmö was the capital of working-class Sweden, a no-nonsense city dominated by solid citizens who worked in the Kockums shipyard and voted for the Social Democratic Party. Then the global economy turned against it. The shipyards contracted and the local factories and textile mills closed. The once-dominant working class shrank to near-invisibility and the population split between professionals living in designer lofts and refugees living in Rosengard’s high-rises. The giant Kockums crane that had become the city’s symbol in 1974 was dismantled and sent to South Korea in 2002. In 2005 the Turning Torso became the city’s new landmark.

The decline of the working class and the increasing polarisation of professionals and immigrants is being repeated across the region. The Nordic countries are still among the world’s most equal, and in one important respect they are becoming more so. In 2010-11 around 60% of university graduates in Finland and Sweden were women. Sweden has almost as many female as male MPs. In Denmark the prime minister and a raft of other ministers are women.

But in other respects money is making the Nordics less equal. As a proportion of the economy, Sweden’s private-equity industry is second only to Britain’s in Europe, and Norway is awash with oil money. Some of the new rich are splashing out on Porsches and big houses, but most prefer to spend their money in subtler and less conspicuous ways. Even so, they live in a different world from the immigrants stuck in Rosengard.