Major German carmakers saw sharp quarterly sales declines in China as domestic demand weakened and competition heated up in the world’s biggest auto market.

At Volkswagen, Mercedes-Benz, BMW and Porsche, China sales for the April-June quarter plummeted between 30% and 41% compared with the same period a year ago, according to company data released over the past week.

For the first half of this year, they all reported a more than 20% year-on-year drop in China. The falling China sales have squeezed their overall profits and in some cases offset gains from other regions.

This also comes at a time when these legacy German carmakers are faced with intensified competition from Chinese automakers outside of China, including in Europe, as leading Chinese brands like BYD make inroads overseas.

The latest quarterly sales declines were some of the steepest seen for the German automakers in China, said Lei Xing, an independent auto analyst.