Tesla signed a deal Tuesday to build its first factory outside the U.S. in Shanghai, making it the first wholly foreign-owned automaker in China.

The announcement comes amid mounting U.S.-Chinese tension over technology and joint ventures, and follows Beijing's April promise to end restrictions that required foreign automakers to work through local partners. Tesla said the China factory would not affect production in the United States, which is forecast to increase.

The company said construction would begin in the near future, once official permits are obtained. Production is expected to begin two to three years after that with an eventual goal of 500,000 vehicles output annually. No financial details were announced. A city government statement said the factory would be the biggest foreign investment to date in Shanghai, which is also a base for joint ventures between General Motors Co. and Volkswagen AG and a state-owned automaker. The signing ceremony was attended by Tesla chairman Elon Musk, Mayor Ying Yong and other Chinese officials, according to the city government.

Get Breaking News Delivered to Your Inbox

Tesla began selling cars in China in 2014, shipping them from its California factory, which added a 15 percent import duty to the price. Despite that, China quickly became its No. 2 market after the United States. "Tesla is deeply committed to the Chinese market," the company said in a statement. Tesla is among companies hit by additional 25 percent import duties imposed by Beijing in retaliation for a tariff hike by U.S. President Trump in a dispute over technology policy.

China is the world's biggest electric vehicle market, and automakers are pouring billions of dollars into developing models for it. Sales of pure-electric passenger vehicles in China rose 82 percent last year to 468,000, according to an industry group, the China Association of Automobile Manufacturers. That was more than double the U.S. level of just under 200,000.

But Tesla and producers including GM and Nissan Motor Co. had been reluctant to transfer manufacturing to the country due to the requirement to share technology with Chinese partners that might become rivals. Ford, GM, Nissan, Volkswagen and other competitors have announced ventures with local automakers to develop models for China's lower-income market.

Beijing is using access to its market as leverage to induce global automakers to help Chinese brands develop battery and other technology. Auto brands in China are required to make electric vehicles at least 10 percent of their sales starting next year or buy credits from competitors that exceed their quotas.

Industry analysts said that the ruling Communist Party believes its own producers such as BYD Auto are close to being able to compete with global brands in performance and price. Ownership restrictions on other parts of the auto industry are to end by 2022, the government has said.