China’s demand for electric vehicles has delivered the nation’s homegrown carmakers a seemingly unassailable and irreversible lead over foreign rivals in the world’s biggest auto market.

Led by the likes of BYD Co. and Geely Automobile Holdings Ltd., Chinese firms grabbed more than 50 percent of total auto sales for the first time in July, according to China Automotive Technology and Research Center data.

That growth is coming at the expense of legacy German, U.S. and Japanese automakers including Volkswagen, Ford and Toyota. UBS AG analysts earlier this month warned western carmakers are set to lose a fifth of their global market share because of the rise of more affordable Chinese EVs.

As Chinese buyers increasingly favor domestic brands, foreign manufacturers are in retreat. Hyundai is selling production facilities, Ford has cut jobs and Stellantis last year shuttered its only Jeep factory in China. Mazda Chief Executive Officer Masahiro Moro openly fretted after he took over the top job about how the country’s auto market is trending.

“China is progressing with a scary speed,” Moro said. “Our sales in China, as well as earnings, will suffer.”

BYD alone holds an 11 percent share of China’s auto market. Its strategy of selling a wide range of EVs at price points ranging from the budget Seagull and Dolphin to the top end of the market has helped fuel its rapid growth. Eleven of the 20 top-selling brands in China are now from local companies.

The market share of U.S. brands including Buick, Ford and Chevrolet has fallen to the lowest since the China Automotive Technology and Research Center began tracking the data in 2008. Without EV pioneer Tesla, which opened its Shanghai factory in 2019, the picture would be even worse.

While German brands are faring slightly better, cracks are appearing. VW earlier this year lost the title of China’s top-selling car brand to BYD, dogged by a lack of electric models, and even Mercedes-Benz has been caught up in the country’s bruising price war.

To get back in the game, VW in July struck a $700 million deal for a 5 percent stake in loss-making EV upstart Xpeng Inc., including an agreement to make at least two new VW-badged electric models for the Chinese market.

Among the losers, French automakers have seen their popularity collapse to the point that they’ve become also-rans, with Citroën, Peugeot and Renault all having less than 1 percent market share. It’s no wonder Stellantis CEO Carlos Tavares is shifting his strategy in China. Exiting factories and relying more on partners will leave the company with an asset-light business that’s less of a cost burden.