New York (CNN Business) Building a car in the United States, and buying one, could get a lot more expensive.

Every American auto factory depends on Mexican parts to build its cars or trucks. That's why President Donald Trump's threat to impose tariffs on Mexican imports of up to 25% by October is rattling the US auto industry. The tariffs could raise costs in the United States by tens of billions of dollars in the auto industry alone.

Car buyers would probably pay the cost of those tariffs.

"We believe the tariffs on vehicles would undoubtedly be passed on to consumers," wrote Emmanuel Rosner, auto analyst for Deutsche Bank. If the Trump administration enforces the full 25% tariff, it would increase the price of vehicles sold in the United States by an average of about $1,300, Rosner said.

That price increase would hurt demand for cars, perhaps cutting US auto production by as much as 3 million vehicles a year, an 18% drop from current levels, Rosner estimates.

If that happened, it would be the greatest blow to the US auto industry since the Great Recession sent the industry hurling toward near collapse 10 years ago.

The industry imported $59.4 billion in parts from Mexico last year, according to US government trade data . That includes parts used in factories and those sold in auto parts stores and repair shops.

Mexico is by far the largest foreign source of parts used by the industry. About 16% of all auto parts used by US assembly plants come from Mexico, according to an estimate from the Center for Automotive Research, a leading industry think tank.

Automakers can't easily shift to other suppliers to avoid using parts from Mexico. Mexican parts suppliers specialize in providing low-cost, labor-intensive components, which don't make economic sense to build elsewhere, said Kristin Dziczek, vice president of industry, labor and economics at the center.

For example, 70% of wire harnesses, the collection of wires that carry power throughout a vehicle, come from Mexico. Few if any wire harnesses are made in the United States. Much of the rest of the harnesses arrive at the US-Mexican border from countries south of Mexico.

"It's one of the first pieces you install when you're assembling a car," she said in April when Trump was threatening to close the border with Mexico altogether. Such a move would have shut the entire US auto industry within a week, she estimated.

"You can't build the whole car and slap the wire harness in later. This is a big critical part that shuts down the assembly line if you don't have it."

Finished cars and trucks also come into the United States from Mexico — about 2.7 million autos were imported from Mexico last year, worth $52 billion, according to the US Commerce Department . That's nearly a million more autos than came from Japan, the No. 2 source of auto imports.

A 25% tariff on all imports from Mexico would add about $28 billion a year to the cost of completed vehicles and parts.

Automakers are strong supporters of the new trade deal that the Trump administration negotiated with Mexico and Canada designed to replace NAFTA. That trade agreement, the US Mexico Canada Agreement (USMCA), would continue to allow most auto parts and vehicles to cross the border in both directions without tariffs. But it needs Congressional ratification before it takes effect.

The USMCA "relies on duty-free access to be successful. The imposition of tariffs against Mexico will undermine its positive impact and would impose significant cost on the US auto industry," said Matt Blunt, president of the American Automotive Policy Council, an industry group representing GM, Ford and Fiat Chrysler.

General Motors GM Ford F The US auto industry is already struggling with increased costs because of the Trump administration's tariffs on steel and aluminum. Bothandhave estimated that rising commodity prices from those tariffs have raised their costs by more than $1 billion each.

The entire industry has been trying to cut costs to free up cash for the expensive research and development challenge of developing the next generation of electric and self-driving cars. That is the reason GM cited for its plans to close four US factories this year.

That means automakers probably wouldn't assume the cost of the tariffs. Instead, they would pass them onto consumers. That could hurt American auto sales and cost additional jobs in the United States. Last year, GM warned that a proposal to put tariffs on all cars and auto parts imports from around the world would lead it and other automakers to cut US jobs

Costs would rise even further if Mexico responds by imposing tariffs of its own on American goods. That would be a double blow to the US auto industry, because Mexico is a major market for both its cars and its parts.

Mexico bought 140,600 cars from the US last year, about 8% of all car exports, making it the fourth largest market behind Canada, China and Germany, according to the US Commerce Department . Those cars cost $3.3 billion.

More importantly, US parts makers shipped another $32.5 billion worth of parts to Mexico, mostly to use in Mexican auto plants.