Not long ago, Yasin Günay overheard colleagues at the steel company where he works, Hüttenwerke Krupp Mannesmann, in Duisburg, Germany, complaining bitterly about immigration. Chancellor Angela Merkel had accepted hundreds of thousands of asylum seekers the previous year, and with the right-wing Alternative for Germany party stirring up ugly stereotypes, anti-immigration talk had intensified throughout the country. As Günay, a child of Turkish immigrants, stood by, his colleagues—rank-and-file workers like himself—egged each other on. One of them remarked that if someone would just cut a hole in one of the refugees’ boats, they’d have a thousand fewer problems.

Günay is even-tempered, but he felt like shouting. Instead, he says, he broke up the gathering and asked everyone to reconvene in half an hour for an honest, objective discussion about immigration. That his colleagues showed up—and that, over time, Günay changed the way some of them viewed the issue—reveals a lot about why Merkel remains the chancellor of Germany.

I met Günay during a visit to the western Ruhr region in September, just before the German election. I’d traveled there because it most resembles the states responsible for tilting the U.S. election in Donald Trump’s favor—an industrial area known for producing coal and steel. In recent years, it has faced familiar troubles. Most of its coal mines have shuttered, and steelworkers have come under pressure from automation and Chinese competition.

But while disaffected workers in the Rust Belt had gravitated toward Trump’s message in large enough numbers to swing the election, the AfD’s appeal had been limited in the Ruhr region. Three days after my visit, Merkel’s Christian Democratic Union, along with a sister party, won the national election with 33 percent of the vote. The AfD outperformed pollsters’ predictions, with the third-highest share of votes, after the center-left Social Democratic Party—nearly 13 percent, enough to enter parliament for the first time. It was an impressive, and sobering, result. Yet it might easily have been worse. In May, in the French election, the nationalist leader Marine Le Pen carried 34 percent of the vote. Before that, more than half of the United Kingdom had voted to exit the European Union. And while the AfD did well in the east (which is more socially conservative and economically troubled than the west, akin to the American South), its results in the industrial west were lower than the national average.

There are several explanations for the AfD’s qualified success. Germany’s Nazi past has left its citizens wary of racialized rhetoric; its multiparty political system offers voters several choices (the business-oriented Free Democratic Party also made gains); Trump and the Brexit vote have given a bad name to right-wing, antiestablishment politics. But the explanation that came up most often in my conversations with politicians, political scientists, and regular Germans was an economic one.

German workers’ sense of security and belonging mitigates the fears that have fed right-wing populism elsewhere.

Germany is much more equal than the United States. The top fifth of U.S. income earners make eight times as much, on average, as the bottom fifth, while in Germany, the higher earners make only about four times as much, largely because CEOs and other well-paid Germans have seen their incomes go up less, over time, than their counterparts in the U.S. The German tax system distributes more from the rich to the poor, and unlike in the U.S., the government covers the cost of basic social services—health insurance, child care, nursing care, even college. Americans believe that their country’s free-market economy fosters healthy competition and allows the energetic and entrepreneurial to inevitably rise; in fact, economic mobility is considerably greater in Germany’s “social-market economy.”

“This is a country which to some extent guarantees its people access to essential facilities, like health and education, regardless of their income level. In exchange, people are less ready to support right-wing populism,” Friedrich Heinemann, an economist at the Centre for European Economic Research, in Mannheim, told me. “They say, ‘Okay, this is a country where we can live well.’ ” Of course, social spending doesn’t make countries immune to populism—look at Le Pen’s success in France, which invests even more in welfare programs than Germany does. But the combination of market forces and the social safety net that Germany has engineered does seem to have kept most people there feeling satisfied that the government is looking out for them. As of last year, 55 percent of people in Germany said they trusted their government, compared with 30 percent of people in the United States.

The contrast between Germans and Americans is perhaps most pronounced for industrial workers like Günay. Because Germany’s economy is driven by manufacturing exports, a higher proportion of Germans have worked in that sector than in the U.S. and most other developed countries. The percentage has slid over the past several decades, but 19 percent of Germans still work in manufacturing, compared with 10 percent of Americans. That has helped make workers a powerful political constituency, and they’ve consolidated that power by creating strong unions. Unions in Germany and the U.S. have fought similar battles, but the Germans have been more successful in winning favorable wages and working conditions: a minimum wage equivalent to $10.40, as opposed to $7.25 in the U.S., for example; and mandated parental leave of up to 14 months, compared with none in the U.S. (In Germany, collective bargaining generally takes place at a sector-wide level, as opposed to a single union negotiating with a single employer, giving labor that much more leverage in talks.) Unions in Germany are deeply involved in the highest level of decision making on key issues, such as how to prepare the workforce of the future. In many cases, when German companies automate their factories, workers are ready to operate the new machines themselves. These efforts haven’t walled off workers from the incursions of automation or foreign competition. But by and large, German workers have had more help adjusting to the fast-changing playing field than American workers have. They feel a sense of security and belonging that serves as a bulwark against the fears of marginalization that have fed right-wing populism elsewhere.

Workers’ rights are also represented outside of the union structure. If America’s prototypical admirable business is the public, profitable Fortune 500 behemoth—or, in more recent history, the lean, nimble Silicon Valley start-up—Germany’s is the medium-size, family-run regional manufacturing firm whose owners live in the same communities as their blue-collar workers and are said to feel more invested in keeping them employed. This system is partly a function of tradition—until the 1800s, Germany was made up of autonomous states that had to sustain independent economies—but national policies, such as government-funded R&D programs that benefit small and medium-size companies, have reinforced it.

Thanks to a concept called co-determination, codified in German law, companies’ shareholders are also expected to share decision-making rights with workers. To that end, employees can create corporate-funded “works councils,” independent from unions, that influence decisions on issues such as working hours and vacation time; at companies of at least 500 employees, workers even select up to half of the board members.

Yasin Günay is a member of the works council at Hüttenwerke Krupp Mannesmann, a position that commands considerable respect. As the election neared, Günay told me, he waged a campaign of quiet influence. He let his colleagues air their worries about immigration and globalization, but urged them to question their assumptions: If the AfD wanted to help workers, why did it seem more inclined to defend the rights of employers than employees?

While Günay was running interference on the factory floor, his union was coordinating an anti-AfD campaign of its own. IG Metall is the largest union in Germany, and it has firmly opposed the AfD, which takes a dim view not just of immigration but of the country’s place in the European Union. Many of IG Metall’s members are immigrants, and Germany’s export-oriented market means that its role in the EU has largely benefited the union’s members. In the Ruhr region, IG Metall adopted conventional strategies, such as publishing op-eds, organizing marches, and plastering cities with posters, but also more guerrilla-ish tactics, such as printing coasters with clever pro-multiculturalism messages on them and leaving them at local bars.

Over time, Günay says, his colleagues’ rhetoric softened; IG Metall executives observed a change, too. “The AfD works on the emotional level, and it’s always hard to confront emotions with real facts,” Knut Giesler, IG Metall’s chief for North Rhine–Westphalia, told me. “But we managed to do it.”

Can the United States learn from Germany’s example? The German system is a product of the country’s culture and history as well as its economic structure, and it may not be possible to replicate in the United States. In fact, some evidence suggests that Germany is moving in America’s direction, not the other way around. In recent decades, the German government has cut back on social benefits that were seen as hampering growth and keeping able-bodied people from working, and unions agreed to slow down wage increases in order to minimize layoffs. Unemployment fell, but inequality rose—a fact that, in the postelection analysis, was cited as one reason for the AfD’s surprising showing.

Still, the election of Donald Trump laid bare a deep, pervasive sense of disenfranchisement among America’s Rust Belt workers—and demonstrated the power they have to send a message to elites of both parties. Seen in the context of the German experience, perhaps there’s something heartening for American labor in Trump’s victory. He has thus far failed to deliver on his outsize promises to workers in states like Ohio, Pennsylvania, and Michigan. But his opponents seem finally to understand that they can no longer ignore the gap between America’s rich and poor, or the demands of struggling workers. Rather suddenly, aspects of Germany’s social-market economy—tuition-free college, government-sponsored health care—are now being discussed with seriousness in America’s halls of power.

No one expects American unions to achieve the stature of their German counterparts anytime soon, but labor in the U.S. has been breaking from the traditional playbook. A new breed of worker-advocacy groups, known collectively as “alt-labor,” has successfully used the tools of the digital age to organize workers and educate them about their rights, while putting public pressure on employers to offer higher wages and better working conditions. Employees at Walmart, the largest private employer in the U.S., started an organization called our Walmart, which built an app that helps workers get advice from one another and collects information about their complaints. Andrea Dehlendorf, a co-director of our Walmart, told me that alt-labor often attempts to mobilize large categories of workers—restaurant employees, for example—to address problems in entire industries, an ambitious strategy that bears some similarities to Germany’s sector-wide bargaining. “We’re looking at models like Germany,” Dehlendorf said, “as providing a potential road map for building a new labor movement in the United States.”