Tesla's ambitions in China have hit a snag after regulators ordered the company to fix safety issues with most of the cars it has sold there. Regulators said more than 285,000 of the company's vehicles are affected.

The State Administration for Market Regulation said the recall involved 211,256 locally produced Model 3 sedans, 35,655 imported Model 3s and 38,599 locally produced Model Y midsized SUVs. The recall affects all of the Model Ys the company has sold in the country.

The agency said the affected vehicles' autopilot systems can activate automatically - which could lead to sudden and unwanted acceleration. Tesla China said the fixes can be done remotely through an online update to the vehicles' cruise control software.

Tesla China issued an apology on its official Weibo account, stating it will adhere to all national requirements. In April, the company was hit with online complaints after reports of crashes went viral. A group held a protest at the Shanghai Auto Show.

Tesla depends on the success of its Model Y in China to hit its earnings target. The company's chief executive officer Elon Musk has said the Model Y could potentially outsell all of its other models.

China's Passenger Car Association upgraded its forecast for that model earlier in the month - saying there was strong demand for roomier SUVs in the country. In May, Tesla more than doubled the sales of its $53,000 China-made Model Ys compared with the previous month.

"Once the Model Y gets to full production, we'll probably see a ratio of almost a 2-to-1. Chinese consumers love SUVs and crossovers. I think the Model Y is going to do really well toward the end of this year," analysts at Beijing-based consultancy company Sino Auto Insights said earlier in the month before the recall order.

In March, the China government banned all Teslas from entering military complexes and other sensitive areas as a result of the cars' built-in cameras. The company immediately told the government data collected by the cameras were stored locally only.