In Dortmund, worker representatives have successfully pressured companies to finance retraining or early retirement for laid-off workers. Sabine Birkenfeld, chairwoman of the workers’ council at a ThyssenKrupp steel galvanizing factory in Dortmund, has lived through serial mergers and layoffs over the years that reduced the work force by 90 percent to 1,300 people.

Still, she said, “no one had to go to the unemployment office.”

The struggle continues. Ms. Birkenfeld arrived for an interview with The New York Times wearing a hard hat after touring the factory floor to urge workers to protest plans by ThyssenKrupp to merge its steel operations into a joint venture with Tata Steel. ThyssenKrupp said the deal would lead to the loss of 2,000 jobs.

Ms. Birkenfeld said workers would push hard for the best possible terms. “If no one lands on the street,” she said, “then there won’t be any fodder for the right-wing parties.”

It won’t be clear until the vote on Sunday whether Germany has succeeded in containing right-wing sentiment. Some analysts say the rise of populist parties stems not from economic factors, but rather from a feeling by some voters that mainstream politicians are not listening to them. In that case, Dortmund’s revival would provide no insurance against a right-wing surge.

“It’s not economic conditions but whether they perceive their concerns are heard by the establishment,” said Timo Lochocki, a fellow at the German Marshall Fund of the United States.

A wild card is whether AfD’s anti-foreigner policies, including calls for armed guards at the borders, will resonate with some voters here.

Emad Abdelmalak, a 30-year-old Egyptian studying in Dortmund, said he did not think so. Mr. Abdelmalak has sensed hostility in Germany once or twice since arriving three years ago, he said. But, he added, “in Dortmund I’ve never had this feeling.”