Sweden’s reputation for fairness and tolerance took a nasty hit this month after a xenophobic anti-immigrant party that misleadingly calls itself the Sweden Democrats won 20 seats in the 349-seat Parliament. Neither of the two main coalitions secured a clear majority, so this former fringe group is hoping to leverage its power.

Prime Minister Fredrik Reinfeldt plans to stay on as head of a minority center-right government. For now, all of the mainstream parties say they will make no deals with the Sweden Democrats. They should stand firm.

Most Swedes abhor racism. But they have legitimate complaints about inadequate government policies for integrating poorly prepared new arrivals. At a time of high unemployment and growing pressure on the traditionally generous welfare state, highly visible immigrant communities — like the 500,000 Muslims who now make up roughly 5 percent of the overall population — make especially tempting scapegoats.

The Sweden Democrats have tried, somewhat, to soften their image. The party no longer calls for mass expulsions of Muslim immigrants. Its platform still calls for sharply cutting the number of foreigners granted asylum or admitted to join family members, and for force-feeding what it considers true Swedish culture. It particularly targets Muslims — it calls Islam “unSwedish” — many of whom have fled persecution and upheaval in Iraq, Iran and the former Yugoslavia.

Sweden’s immigrant populations tend to live in ghettoized areas, receive inferior public educations and suffer higher unemployment and arrest rates than the native-born population. These problems have received too little official attention and financing, not too much.

Keeping immigrants out is no answer. Nor is forced assimilation to an imaginary pure national culture. Immigrant dynamism is essential to keeping all of Europe competitive. Sweden’s mainstream politicians are still battling over old questions of welfare versus markets, while largely ignoring newer ones like globalization, immigration and social integration. They can’t afford to ignore them any longer.