Uber and Lyft were ordered to convert their California drivers from independent contractors to employees with benefits, an early loss in a court battle the gig economy cannot afford to lose.

The judge’s ruling Monday will not be the last word: The ride-hailing companies are expected to appeal the far-reaching preliminary injunction that could make them halt their services as they figure out how to adjust their business model to comply with it.

The case brought by California officials to enforce a state labor law that took effect this year is the most serious legal threat yet to the gig economy – and comes as many companies that rely on contractors for on-demand services are already reeling from the pandemic. The news erased some of Lyft’s stock gains Monday, and Uber shares were little changed.

San Francisco Superior Court Judge Ethan Schulman agreed to pause the injunction for 10 days so the companies can appeal his decision. Schulman agreed with California Attorney General Xavier Becerra that Uber and Lyft are violating Assembly Bill 5, which says workers can generally only be considered contractors if they perform duties outside the usual course of a company’s business. If the companies are forced to reclassify their California drivers as employees, they would be on the hook for overtime, health care and other costly benefits.

Lyft’s lawyer argued at an Aug. 6 hearing that the injunction sought by Becerra would wreak havoc on the companies’ services and cause “massive harm” to drivers and riders.

The city of San Francisco, where both ride-hailing companies are based, joined Becerra’s suit and argued drivers have suffered for years as Uber and Lyft had have grown into giants by violating state labor law.

The case is California v. Uber Technologies Inc. and Lyft Inc., CGC-20-584402, California Superior Court (San Francisco).