U.S. President Donald Trump looks up while signing an executive order to advance construction of the Keystone XL pipeline at the White House in Washington January 24, 2017. Reuters/Kevin Lamarque President Trump argues that too many US workers have lost their jobs to foreign peers as companies have offshored manufacturing.

US companies need to bring those jobs back and, in doing so, restore America’s industrial greatness. His diagnosis isn’t altogether wrong: fewer companies manufacture cars, for instance, in the US than was previously the case. But this thesis is too simplistic.

US companies are really just trying to allocate capital efficiently when they manufacture goods outside of the US. At a company level, it makes sense to manufacture your goods in a country where wages are competitive, standards are high and trade agreements are in place. Wages are lower in Mexico than the US and it has decent production standards and trade agreements with the US.

The debate often gets boiled down to one about wages. But companies choose to base their resources in countries for a whole range of reasons. For instance, BMW follows a motto “production follows the market”. It avoids import duties by developing a market for its cars through manufacturing them in that market. As a result it has factories in South Africa, Thailand, Great Britain and the US.

Establishing a plant in South Carolina in 1994 allowed them to increase sales in the country from 50,000 to 260,000, making the US the company’s single largest market. The reason that BMW builds factories where they do is driven by the efficient allocation of capital. If it were forced to move all manufacturing back to Germany then it would impact the entire company’s strategy, not just its wage bill.

If President Trump really does push companies to base more of their production in the US then those that specialise in robotics and automation will probably be the winners. Companies won’t automatically employ more Americans. They will rethink their strategies and some will inevitably look to automation as a way to avoid the higher costs of employing US workers.

YouTube/iPhone-Fan This will accelerate a global trend towards greater automation that is already going on. Boston Consulting Group thinks the share of tasks performed by robots will increase from 10 percent to 25 percent by 2025. Amazon has an entire division dedicated to robotics. Its acquisition of robotics company Kiva in 2012 means much more of what goes on in Amazon’s vast warehouses is being automated. Humans still have a role but the investment is squarely in robotics. Three years ago the US Bureau of Labor Statistics produced projections of which jobs will see the largest declines and growth between 2014 and 2024. Manufacturing is predicted to decline more than any other major sector. Not all of this is because of automation, but it will play a part.

Companies reshoring to the US will not just rethink their manufacturing processes either. They will look to reduce costs across the business. That could well mean automating other areas of the business from payroll to distribution. Especially given the fact that countries like the US are actively fostering the technology that makes this possible. US companies are developing driverless vehicles and authorities are supporting that development by giving safety and regulatory guidance. There is much less certainty in developing markets about how such technology will develop. It is therefore easy to see the appeal of driverless vehicles to a manufacturer in Milwaukee over one in Mexico.

This is where the opportunity really lies for the US. It cannot realistically bring back the jobs that have gone. Doing so would create a new breed of zombie company, ticking over but with very thin margins. Instead, the US can continue to dominate the world in the development of the automation and robotics technology which all companies are scrambling to embrace. When Amazon bought Kiva it immediately gained a competitive advantage because it bought the market leading robotics firm. Other companies who relied on Kiva’s technology were left having to find an alternative. In buying Kiva, Amazon opened up a big competitive gap over other companies.

The big question is whether this new technology can create the amount of jobs, either directly or indirectly, to replace those lost to this self-same technological advancement. No one really knows the answer. But what is clear is that, if America is going to keep benefiting from this technological boom, then it needs to focus on the efficient allocation of workers and capital into high-tech industries. President Trump’s current approach will force companies to react but it probably won’t achieve what he hopes it will.

Paul Diggle is Senior Economist, Investment Solutions at Aberdeen Asset Management.