Much of the support for the far right in Denmark comes from the working class, which chafed the most at ultraliberal immigration policies that allowed thousands of immigrants — from Iran, Iraq and the Balkans — to enter the country in the 1970s, ’80 and ’90s.

Denmark had few policies in place to deal with the immigrants’ needs, experts say. Blue-collar Danes resented that many newcomers in their neighborhoods never learned Danish and remained unemployed, clustered in the suburbs of Copenhagen.

While mainstream parties avoided the subject as politically incorrect, the Danish People’s Party, led by Pia Kjaersgaard, a home care attendant for the elderly before she entered politics, took it on. Ms. Kjaersgaard is widely credited with forcing an overhaul of the country’s immigration policies, now among the most restrictive in Europe.

Many of her supporters are like Rene Schultz, a 42-year-old furniture mover from Ishoj who is wistful for simpler times and blames immigrants for a rise in crime, though official statistics do not support this claim.

“We need to close the borders,” Mr. Schultz said. “And if they throw us out of the European Union, that’s fine with me. There was a robbery here just last week. The old people are afraid to go out.”

Martin Henriksen, the party’s spokesman for social issues, said that for a country to survive, its people must share values and customs. He predicted that Sweden would fall apart because so many immigrants were living there. And he called the European Union’s objections to the border deal absurd. “If we throw someone out of the country because he is a criminal, he can turn around and walk back in,” Mr. Henriksen said. “That is ridiculous.”

Just how much more Europe’s nationalist parties can grow is an open question. The Danish People’s Party alienated many of its supporters when it signed on to the budget deal, which called for an overhaul of the pension system in order to save costs.