SAN FRANCISCO — Alameda County, where Tesla’s main manufacturing plant is located, cleared the electric-car company to start up again next week with safety precautions in place.

But led by chief executive Elon Musk, Tesla already ramped up production earlier this week, one of the most high-profile violations of a local health order amid the coronavirus crisis and raising questions about county enforcement.

Alameda County said late Tuesday that it had approved Tesla’s site-specific plan to reopen its plant in Fremont, Calif., assuming the company follows strict safety guidelines, including social distancing to prevent the spread of covid-19. Tesla can start preparing this week, and can restart work next week, the county said.

The county said that the Fremont Police Department will make sure Tesla is following the agreed-upon safety guidelines. The plan is also contingent on public health indicators tracking the spread of the coronavirus in the Bay Area.

“We reviewed the plan and held productive discussions today with Tesla’s representatives about their safety and prevention plans, including some additional safety recommendations,” the county’s public health department said in a tweet announcing the decision.

The county did not immediately respond to a request for comment on the plant’s reopening timeline. In a news release, the county said it did not have “any further comment and will not be taking any requests for interviews.”

Tesla did not respond to a request for comment. Fremont Police spokeswoman Geneva Bosques said the department would visit the plant to make sure the safety protocols were being followed. She said the police wouldn’t give specific details about the visit before it happens.

The state of California allowed some business operations to start up again last week, but Bay Area counties have stricter regulations that have not yet been lifted. On Monday, Alameda County told Tesla to stop production, but workers continue to go to work.

Musk on Monday tweeted that officials should arrest him if any enforcement took place. County officials the same day said they were still in negotiations.

On Saturday, Tesla filed suit against Alameda County seeking to stay open. The same day, Musk threatened to move Tesla headquarters, which are located in another California county in Palo Alto, to Texas and Nevada.

He also called interim Alameda County public health official Erica Pan “an unelected county official” after learning that the county orders supersede the more relaxed restrictions from the state.

It’s not Musk’s first attempt to keep the factory open. Workers were asked to report to work as shelter-in-place orders took effect in March, with public health officials stepping in to tell Tesla that the work was considered nonessential. Musk has also emerged as a vocal opponent of government shelter-in-place orders, calling broadly for society to reopen and people to get back to work.

Musk tweeted a picture of an ice cream sundae at a restaurant Tuesday night, replying “Life should be lived.” He told a commenter he got it at “Buca,” referring to Italian chain restaurant Bucca di Beppo. But the photo appears to have been taken from Buca di Beppo’s own tweet in March 2017.

The brash chief executive has corralled other leaders in Silicon Valley to his cause, and President Trump tweeted his support Tuesday for the Tesla plant to reopen this week.

On Saturday, Tesla posted a blog about its return-to-work plan, saying it is the result of “careful” planning for months. It calls for some temperature-check protocols and reduced break-room capacity to maintain social distancing.

Some Fremont workers who spoke on the condition of anonymity because they were not allowed to discuss the matter publicly said that factory workers were not observing proper social distancing.

Musk retweeted an article Tuesday night that said that he had emailed employees to thank them for working.

“It is so cool seeing the factory come back to life and you are making it happen!!” it said, according to the report.