Tesla on Saturday filed a lawsuit against the California county that has prohibited the electric car company from producing vehicles during the outbreak.

The company alleged in its suit, filed in the U.S. District Court for the Northern District of California, that Alameda County had violated the due process and equal protection clauses of the Fourteenth Amendment and sought an injunction that would allow the company to operate. Its Fremont manufacturing plant is located in that county.

The suit followed chief executive Elon Musk threatening in a series of tweets earlier Saturday that the company would sue and move Tesla’s headquarters and future programs to Texas and Nevada. He appeared to leave open the possibility of maintaining some operations in Fremont depending “on how Tesla is treated in the future.”

He tweeted that the restrictions imposed by Alameda County are “contrary to the Governor, the President, our Constitutional freedoms & just plain common sense!”

Tesla issued a statement late Saturday saying it would resume production at its facility, implementing social distancing by spreading employees out across its 6 million square foot facility and conducting on-site temperature screenings.

“We will continue to put people back to work in a safe and responsible manner,” the statement said. “However, the County’s position left us no choice but to take legal action to ensure that Tesla and its employees can get back to work.”

County officials said earlier Saturday they’d had a good working relationship with Tesla, but in its statement, the company alleged “the County Public Health Officer who is making these decisions has not returned our calls or emails." The county did not immediately respond to a request for further comment.

In the lawsuit, the company argued that the county-level orders are inconsistent and the state orders should supersede local orders.

“We need to continue to work together so those sacrifices don’t go to waste and that we maintain our gains,” the Alameda County Public Health Department said in a statement earlier Saturday. “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 suit and Musk’s public comments come a day after the company said it would resume vehicle production, only to again provoke the ire of local health officials, who said Tesla “must not reopen.” Alameda County leaders said Tesla did not meet the criteria to resume operations even as California began opening up other parts of the state.

In an earnings call April 29, Tesla CEO Elon Musk called the coronavirus lockdowns "fascist," and said people should get back their "freedom.” (Tesla)

Tesla is headquartered in Palo Alto, Calif., which is in a different county, and it conducts much of its manufacturing at its Fremont factory. Both are in the Bay Area, which was the first major region in the nation to order residents to shelter in place, even before the state did.

California this week began loosening restrictions and allowing businesses to start reopening. But the Bay Area counties have not yet followed, and state officials have made it clear that county orders take precedence.

Musk had started calling workers back to the factory Friday. It was at least the second showdown with the county. As Alameda County issued its first shelter-in-place order in mid-March, Musk sent an email to employees telling them he would continue reporting to work, although they could stay home if they felt uncomfortable. County officials then ordered the factory to shut down because it was not an essential business under the county’s definition.

Musk’s tweet came as a shock to many who follow Tesla, even as the CEO had made increasingly erratic pronouncements on and off the platform during the pandemic. The tech billionaire is known for leveraging Twitter to dispense material information, including a tweet in 2018 that said he had secured funding to take the company private at $420 a share. It was unclear if that was true, and he and Tesla were later each fined $20 million by the Securities and Exchange Commission.

Musk has also consistently downplayed the seriousness of the coronavirus public health orders, calling panic over the virus “dumb,” theorizing about the virus’s effect on children and promoting skepticism over the necessity for social distancing and shelter-in-place orders. On Tesla’s earnings call late last month, he launched into a profanity-laced tirade over the ongoing orders after highlighting what he saw as the “serious risk” posed by the factory’s closure.

“To say that they cannot leave their house and they will be arrested if they do, this is fascist,” he said on the call. “This is not democratic — this is not freedom.” The previous day, he tweeted, “FREE AMERICA NOW.”

Then on May 1, he tweeted Tesla’s stock was priced “too high,” sending the share price plunging during the middle of the trading day.

Musk highlighted Tesla’s economic footprint in a subsequent tweet Friday, noting the size of its manufacturing operation in a likely attempt to sway California officials. The Fremont factory employs 10,000 workers.

In a statement posted online, Fremont Mayor Lily Mei said, she was growing concerns about the regional economy without provisions for major manufacturers like Tesla, and believes that safety practices could be implemented there too.

“The City encourages the County to engage with our local businesses to come up with acceptable guidelines for re-opening our local economy,” she said. "As we have done for over a decade, the City is prepared to support Tesla as soon as they are able to resume automobile manufacturing operations and are committed to a thoughtful, balanced approach to this effort that remains safe for our Fremont community.”

Texas Sen. Ted Cruz (R.) tweeted his support for Tesla moving to his home state. Texas was an early mover on reopening.

“We love jobs & Texans very much want to open up & get back to work (while still staying safe & following sounds science),” Cruz wrote.