We collected years of data for every state and province in North America, and the conclusion is clear: US president Donald Trump’s belief that manufacturing equals prosperity doesn’t hold up.

As Trump tells it, it was the migration of American factories overseas that snatched middle-class existence from hard-working Americans. On July 17 he launched “Made in America” week and sent Congress a list of his goals for the renegotiation of the North American Free Trade Agreement (Nafta), which begins on Aug. 16. The first of those goals: to reduce the US’s trade deficit, presumably by stamping more stuff with “Made in the USA.”

If Trump were right, manufacturing workers in Oregon should be doing great. From 2003 to 2015, the state’s manufacturing GDP grew 180%, the fastest pace not only in the US but in virtually all of North America. As a share of Oregon’s GDP, manufacturing doubled to nearly a quarter.

Yet the news for the workers themselves wasn’t so bright. While they would have expected to earn 10% more than the average statewide wage in 2003, today, that premium has shrunk to 3%. In other words, manufacturing in Oregon is now barely better than the average job as a ladder of social mobility.

It’s not only Oregon that debunks the view of manufacturing as an engine of growth. Across the US, Mexico, and Canada, the data we analyzed show that building more factories doesn’t lead to as many jobs as it used to, nor to higher wages, and that closing factories doesn’t necessarily lead to a loss of prosperity.

So what does help create jobs and raise salaries? To find out, keep scrolling.

Aguascalientes, a Mexican state where car factories have mushroomed (Spanish) in recent years, is in a similar position.

And despite the factory boom, manufacturing jobs now account for a slightly smaller share (Spanish, pdf) of employment in the state (24%) than they did in 2001 (26%.)

Contrary to Trump’s claims, the US’s neighbors haven’t sucked away its manufacturing. The industry is declining across the board for all three Nafta countries. And even where the industry is doing well, workers often are not. So what is going on?

Trade didn’t kill manufacturing; manufacturing did

A look at the Nafta region as a whole shows that manufacturing has dwindled in Mexico (and Canada too) as a share of each country’s GDP. More recently, it has picked up in Mexico, on the back of a boom in car-making—but most of the country’s other industries remain sluggish (Spanish, pdf.)

That’s not to say global trade is entirely blameless. In all three Nafta countries, lower tariffs have made it cheaper to import parts and other inputs for making goods than to buy them from small domestic suppliers. It’s also true that machines have been replacing humans on factory floors—even in Mexico, with its relatively low wages.

The root cause of the problem is neither robots nor free trade; it’s uncompetitiveness.

Still, the root cause of the problem is neither robots nor free trade; it’s uncompetitiveness. According to the McKinsey Global Institute, which has studied the US manufacturing sector’s ailments in depth, while some US companies have kept up with international competition and technological change, many are losing out not only to countries with cheap labor but also to some advanced economies, such as Germany and South Korea, where many companies are more productive and profitable. Other experts see a similar problem in Canada and Mexico too.

Squeezed by competition, North American manufacturers are in turn squeezing their own workers by ratcheting back raises and benefits. In the US, for example, temporary workers are doing anywhere from 8% to 10% of all factory work, according to McKinsey’s research. Factories are also getting more done with fewer workers. In all three countries, productivity growth has outpaced wage growth.

And while it’s true that Mexico has gained manufacturing jobs while Canada and the US have lost them, it’s done worse on wages. Mexican factory workers’ average wages have risen just 4% in real terms over more than a decade. In the US paychecks grew by 7% despite the massive job losses.

All of this means manufacturing has fewer benefits to the rest of the economy. “A lot of pluses are attributed to manufacturing, but it is clear that it’s no longer a sector that is going to pull the rest of the economy towards growth,” says Leobardo de Jesús Almonte, an economics professor at Mexico State Autonomous University.

The power of diversity

However, there’s a flipside: Just as a bulging manufacturing sector is no guarantee of jobs or high wages, one that’s sagging doesn’t automatically obliterate salaries.

Why the different outcomes?

A powerful lesson for Trump and others fixated on manufacturing: It pays to be diverse.

One reason is stronger unions in Ontario, which were able to better defend wages; another is that the province’s schools produce highly skilled workers, says Tod Rutherford, a professor at Syracuse University, who has studied auto manufacturing in both places. But Ontario’s diverse economy also played a role. The province doesn’t just build cars; it has pharmaceuticals, finance, biotech, information technology, and other industries. “That just pushes up wage costs, regardless of whether it’s a union job or not,” says Rutherford.

That’s a powerful lesson for Trump and others fixated on manufacturing: It pays to be diverse.

Arkansas offers a poignant example. From 2003 to 2015, manufacturing dropped from 19% of the state’s GDP to 15%. But in the meantime a single company, Walmart, was helping usher in an economic boom in the northwest corner of the state. The retailing behemoth has pulled suppliers—and their suppliers—to Bentonville, where its headquarters are, say Charles Gascon, a regional economist with the Federal Reserve Bank of St. Louis. The area is proof, he adds, that “all it takes is one individual with a really good idea to drastically reshape the landscape of an entire region.”

In fact, average wages in Arkansas grew faster than in Oregon, North America’s manufacturing champion. And as these charts show, in all three countries, whether manufacturing grows or shrinks has basically no bearing on a state’s average wages.

Manufacturing can (and should) be saved

In short, it’s clear that manufacturing can no longer be counted on to produce millions of jobs, nor well-paying ones. But it can still supply other valuable ingredients for overall economic growth. Making things, particularly high-tech products, requires big spending on research and development. That leads to innovation and increases competitiveness. Manufacturers are also big exporters.

So far though, it’s mostly big multinational firms fulfilling that role. Governments and the private sector have to figure out how to include smaller companies. “The issue is not that there is too much global engagement. There is too little,” says Sree Ramaswamy, a partner at McKinsey Global Institute.

“The issue is not that there is too much global engagement. There is too little.”

It won’t be an easy overhaul. Small, left-behind places will probably have to become part of bigger, regional economies to survive, says Ramaswamy. Small companies will need some kind of help to become fit enough to sell abroad, and workers will have to be trained to keep up with a high and ever-changing set of skills.

But mere inventiveness can also go a long way. Take a look at how Alberta-based shoe company Poppy Barley—which only has 14 employees—and its small suppliers in the Mexican state of Guanajuato have managed to squeeze into an industry largely taken over by Asian producers.

They’ve achieved it by doing more than simply churning out footwear. Poppy Barley is also an online retailer, selling directly to customers. It also offers made-to-order shoes; its suppliers are essentially custom shoemakers.

In their case, small size is an advantage. Poppy Barley’s suppliers will make as few as 25 units of a product, compared to the 10,000 production minimums required by some Chinese factories. They can also more quickly shift production to better-selling products, and deliver them sooner, says co-chief executive Justine Barber. “The nimbleness is a huge advantage. It’s worth it for us to pay more to have that kind of response,” she adds.

Like high-tech manufacturing, this kind of niche production isn’t going to lead to massive employment. Still, Poppy Barley shoes are now produced at four factories, up from a single one in 2012. The workers who make them on average get paid six times the Mexican minimum wage, making them better off than roughly two thirds of all employed Mexicans. Multiply the number of Poppy Barleys in the US, Mexico and Canada, and you’re at least on the way to prosperity.