Tesla CEO and wannabe cave diver Elon Musk was in Shanghai on Tuesday to secure a deal with Chinese authorities to build an ambitious new car plant, Tesla’s first outside the US, and a sign that President Trump’s rapidly-escalating trade war might be having an unintended effect. The announcement came just as Tesla raised prices on its vehicles in China to offset the cost of tarrifs imposed by the Chinese government in retaliation for US tarrifs recently levied on Chinese goods.

The plant will start producing cars two or three years after construction begins, according to Reuters, with an eventual capacity of 500,000 cars per year. Tesla is currently in “production hell” trying to build its affordable Model 3 sedan at its existing factory in Fremont, California, although the company recently hit its internal goal of producing 5,000 Model 3s in a week.

Musk has been reported to be considering a Chinese factory for years, as China is widely seen as a potentially massive market for electric vehicles. The country has a stated goal of 100-percent electric vehicles by 2030, as part of its plan to tackle air pollution, so a Tesla plant in the country makes sense. The timeline may have been accelerated by recent tarrifs, however, as well as Tesla’s well-documented cash flow problems. “The Shanghai municipal government will fully support the construction of the Tesla factory,” authorities said in a statement, which could help Tesla build the factory sooner rather than later. With new projects like the Tesla Semi and a Tesla pickup truck on the horizon, as well as a long-rumored European factory, any help Tesla can get with the capital costs of building new infrastructure will be welcome.