Electric car producer Tesla says it will build its first factory outside the United States in Shanghai.

Tesla says an agreement signed Tuesday with a Shanghai city government agency calls for construction to start in the near future. It says production would begin three years after that and eventually increase to 500,000 vehicles annually.

The announcement comes amid mounting U.S.-Chinese trade tensions and follows Beijing’s decision in April to end restrictions that required foreign automakers to work through joint ventures with local partners.

China is the world’s biggest electric vehicle market. Automakers are investing heavily to develop models to appeal to local customers.

Tesla also has hiked the prices of its cars in China by about 20 percent.

It’s the latest major company to feel the impact of the trade war between the world’s top two economies.

Tesla’s China website now lists the cheapest price for a Model S sedan at 849,900 yuan ($128,500), up from 710,600 yuan ($107,400) previously.

At the top of the range, the most expensive Model X crossover is now 1.57 million yuan ($240,000) up from about 1.32 million ($200,000) before.

Tesla didn’t respond to a request for comment on the price rises.

The company had only just cut its prices in China in May after Beijing announced it was slashing tariffs on car imports from 25% to 15%.

That change took effect July 1, but Tesla and other automakers that export from the United States to China only benefited from the reduction for a few days.

Global automaker Daimler warned last month that the new Chinese tariffs would hit its profits, resulting in “fewer than expected SUV sales and higher than expected costs,” which won’t be completely passed on to customers.

China is a huge market for Tesla. Revenues in the country doubled last year to more than $2 billion, accounting for almost 20% of the company’s total.

Increasing prices could threaten its position in such an important market. “This will certainly not be good for consumers or for Tesla’s sales in China,” said Bill Russo, founder of Shanghai-based consultancy Automobility.

He added that Tesla could lose market share to Chinese competitors, such as NIO, as a result. Russo said NIO’s new ES8 SUV has been positioned as a “Tesla-fighter.”

Tesla is the first major US automaker to raise prices in China in response to the higher tariffs. Most big American car companies avoid hefty import tariffs by making many of their vehicles for the Chinese market inside the country through joint ventures with local partners.

Tesla, which only makes cars in California, wants to open a factory in Shanghai so it can sidestep tariffs, but the company still hasn’t landed a deal with local authorities to get it done.

Tesla is reluctant to enter into a joint venture with a Chinese partner because it doesn’t want to share its valuable intellectual property. China’s long term strategy is to become a world leader in electric vehicles.

Beijing said earlier this year that it would allow foreign companies to control electric car manufacturing businesses in the country, potentially opening the door for Tesla.

Higher tariffs “certainly will raise urgency for Tesla,” Russo said. But he predicts it will still be “a long time” before the company can get approval and build a production facility inside China.

Tesla CEO Elon Musk was due to attend a government event in Shanghai on Tuesday, according to Bloomberg, citing unidentified people familiar with Musk’s plans. He will also visit Beijing later in the week, the article said.

The report did not specify the purpose of Musk’s visit to China. Tesla and the Shanghai government didn’t respond to requests for comment.

Musk has given mixed messages on when Telsa could start making cars in China. In November, he said that manufacturing in the country was still about three years away. In June, he told shareholders that an announcement on Chinese production could take place as early as this month.

Musk has said that the factory could produce about 200,000 vehicles a year for consumers in China and possibly elsewhere in Asia.