This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

Tesla CEO Elon Musk threatened Saturday to pull the company’s factory and headquarters out of California and sued local officials who have stopped the company from reopening its electric vehicle factory.

In a lawsuit filed in federal court, Tesla accused the Alameda County Health Department of overstepping federal and state coronavirus restrictions when it stopped Tesla from restarting production at its factory in Fremont. The lawsuit contends Tesla factory workers are allowed to work during California’s stay-at-home order because the facility is considered “critical infrastructure.”

“Frankly, this is the final straw,” Musk tweeted. “Tesla will now move its HQ and future programs to Texas/Nevada immediately.”

He wrote that whether the company keeps any manufacturing in Fremont depends on how Tesla is treated in the future.

Musk has been ranting about the stay-home order since the company’s April 29 first-quarter earnings were released, calling the restrictions fascist and urging governments to stop taking people’s freedom.

An order in the six-county San Francisco Bay Area forced Tesla to close the plant starting March 23 to help prevent the virus’ spread, and it was extended until the end of May. Public health experts say the orders have reduced the number of new coronavirus cases nationwide. California Gov. Gavin Newsom allowed the Bay Area counties to continue restrictions while easing them in other areas of the state.

In a statement Saturday, Alameda County’s Health Department said it has been working with Tesla to develop a safety plan allowing the Fremont plant to reopen while protecting workers. “We look forward to coming to an agreement on an appropriate safety plan very soon,” the statement said.

But the statement also said residents and businesses have made sacrifices to protect the health of people in the region. “It is our collective responsibility to move through the phases of reopening and loosening the restrictions of the shelter-in-place order in the safest way possible, guided by data and science,” the department said.

Fremont Mayor Lily Mei wrote in a statement that she is growing concerned about the regional economy without provisions for major manufacturing to resume operations. “We know many essential businesses have proven they can successfully operate using strict safety and social distancing practices,” the statement said.

Emails seeking comment from Newsom have not been returned.

Despite Musk’s threat, it would be costly and difficult to quickly shift production from Fremont to Texas or Nevada. The Fremont facility, which was formerly run jointly by General Motors and Toyota, currently is Tesla’s only U.S. vehicle assembly plant, and the company would lose critical production if it shut down the plant to move equipment.

“Moving away from Fremont would take at least 12 to 18 months and could add risk to the manufacturing and logistics process in the meantime,” Wedbush Securities analyst Daniel Ives wrote in a note to investors.

But Musk plans another U.S. factory to increase output, possibly in Texas, and could move production once that plant is up and running.

The lack of production in Fremont cuts off Tesla’s revenue and is a big financial strain. On a conference call last month, Musk said the company only has assembly plants in Fremont and Shanghai, and the Fremont facility produces the majority of its vehicles. He called the closure of Fremont a “serious risk.”

The coronavirus causes mild or moderate symptoms for most people. But it has killed more than 78,000 people in the U.S., with the death toll rising.

Ives wrote that there’s now a high-stakes poker game between Musk and county officials — and Musk showed his cards. “Now all eyes move to the courts and the response from Alameda County and potentially California state officials.”

Musk’s tweets come as competing automakers are starting to reopen factories in the U.S. Toyota will restart production on Monday, while General Motors, Ford and Fiat Chrysler all plan to restart their plants gradually on May 18. Tesla is the only major automaker with a factory in California.

Musk’s threats came after a series of bizarre tweets earlier this month, including one that said Tesla’s stock price was too high. Musk also posted parts of the U.S. national anthem and wrote that he would sell his houses and other possessions.

___

Associated Press reporters Michael Liedtke and Daisy Nguyen in San Francisco contributed to this report.