SPARTANBURG, S.C. -- Years before Donald Trump began promising to bring back good manufacturing jobs by getting tough with U.S. trade partners, such jobs have already been on the rise, largely thanks to foreign companies now cast as villains in Trump's narrative.

Reuters analysis of federal jobs data shows that out of 656,000 new manufacturing jobs created between 2010 and 2014, two thirds can be attributed to foreign direct investment.

More recent jobs numbers are not yet available, but over $700 billion in foreign capital has poured in over the last two years bringing total foreign investment to $3.7 trillion at the end of 2016, a world record.

Now foreign companies that have spent billions of dollars on U.S. factories and local leaders who host them worry that global supply networks that back those investments will fray if Trump makes good on his pledge to roll back trade liberalization.

The U.S. president has threatened to tear up the North American Free Trade Agreement with Canada and Mexico and slap higher tariffs on nations that run trade surpluses with the United States, such as Germany or China. The administration is also discussing tighter immigration rules and more security screening of investment.

The tough message helped sway swing northeastern and Midwestern states Trump's way in the 2016 election, but puts him at odds with companies and local leaders in the south, which has driven the recent growth in manufacturing jobs.

The southern states have voted for Trump, but have also spent decades wooing foreign companies with flexible labor laws, financial incentives and investment in ports, roads and other infrastructure.

Poster child, whipping boy

The courtship has spawned new auto plants from Kentucky to Georgia, and a new Airbus plant in Mobile, Ala.

Few places highlight the gap between Trump's rhetoric and local aspirations better than Spartanburg in South Carolina.

German carmaker BMW has invested here $8 billion in a 1.2 million-square-foot assembly plant, which has become the largest single exporter of cars by value from the United States.

South Carolina Gov. Henry McMaster, a Republican and Trump supporter, credits the German automaker for putting his state on the global investment map.

"The presence of this company changed everything in the trajectory of our state," McMaster said on Monday at an event unveiling BMW's newest X3 SUV.

BMW CEO Harald Krueger said the carmaker would invest additional $600 million in Spartanburg over the next four years, adding 1,000 jobs to the 9,000-strong workforce, and spend further $200 million on employee training and education.

But the poster child of South Carolina's success also doubles as a whipping boy. In January, BMW's plans to build a plant in Mexico drew Trump's ire and last month the U.S. president was quoted as saying Germany was "very bad" on trade and selling too many cars in the U.S.

And even as the company highlights its contribution to the U.S. economy and the benefits of free trade, it is hedging its bets by preparing for a possible protectionist backlash.

Outside of the spotlight, BMW is retooling factories in South Africa and China to build volume models like the X3 SUV, reducing its dependence on Spartanburg.

“We have a big footprint here, and we are flexible enough," Oliver Zipse, BMW's board member responsible for manufacturing, told Reuters. "We will build the X3 not only in Spartanburg, we will split it into South Africa and then to China, so we will have some flexibility to produce cars somewhere else,” he said. “If something happens at the political level -- which we don’t know yet -- we are able to have a flexible response.”

The Trump administration has said it welcomes foreign investment and Secretary of Commerce Wilbur Ross, who spoke at an opening of a new Samsung Electronics plant in South Carolina, said such projects showed that "America is becoming an even stronger destination for global businesses looking to grow.”

The southern U.S. states owe much of their success to coastal port authorities and cities that have invested heavily to make their channels and docks fit for shipments to and from China and Mexico. U.S. Sen. Lindsey Graham, R-S.C., who has often clashed with Trump, said protectionism would undermine those accomplishments and hurt American workers.

Doomsday scenario

"Negotiate a trade agreement with Europe, modernize NAFTA, don't tear it up," Graham told Reuters at the BMW factory. "We're going in the wrong direction. We need more trade agreements, not less."

Graham noted how low-cost competition from China and Mexico destroyed South Carolina's once thriving textile industry and how the state reinvented itself as a manufacturing hub, bringing the likes of BMW or French tire maker Michelin.

The now humming port city of Charleston has a similar story to tell. When a major navy base shut down in the 1990s wiping out 20,000 jobs, local officials worked to bring foreign manufacturers, which now employ around 10,000 in the three counties around the city and more is set to come.

Mercedes-Benz, part of Daimler AG, is adding 1,300 jobs so it can make its Sprinter van here rather than merely assemble it with imported parts, which also means more business for local suppliers.

Up the road, Volvo Car Group, part of Chinese conglomerate Geely, is due to open its first North American plant next year with a target workforce of 2,000.

Local development officials expect more jobs and investment to come, but worry that some steps discussed by the Trump administration could have a chilling effect.

Claire Gibbons, director of global marketing at the Charleston Regional Development Alliance, said the proposed new tariffs, tougher immigration rules and stricter reviews of foreign investment projects would amount to a "doomsday scenario" for the region.

"This is an education opportunity for us all, for the people making the decisions that don't understand the ramifications."