by Dara Kerr

SAN FRANCISCO (CNET) — In a blow to Uber and Lyft, a judge in San Francisco ruled Monday that the ride-hailing companies must start classifying their drivers as employees in the state. This is something the companies have fought for years because it would mean millions of dollars in added costs and a complete overhaul of their business models.

Judge Ethan Schulman of the San Francisco Superior Court wrote in his decision that the injunction won’t be enforced for 10 days, so as to give Uber and Lyft a chance to appeal — something both companies said they’ll do.

READ MORE: Man Charged In Deadly March Shooting At 24th Street Mission BART Station

“We’ll immediately appeal this ruling and continue to fight for [drivers’] independence,” a Lyft spokesman said. An Uber spokesman said, “We plan to file an immediate emergency appeal on behalf of California drivers.”

The injunction is part of a lawsuit brought against the two companies in May by the state of California and in conjunction with the city attorneys from San Francisco, Los Angeles and San Diego. The suit alleges the ride-hailing companies have violated state law AB 5 and “exploited hundreds of thousands of California workers” by classifying their drivers as independent contractors rather than employees.

“This is a resounding victory for thousands of Uber and Lyft drivers who are working hard — and, in this pandemic, incurring risk every day — to provide for their families,” Los Angeles City Attorney Mike Feuer said in a statemet. “Of course our fight is not over and we will vigorously pursue this litigation until these workers have the permanent protection they deserve.”

The debate over driver rights has raged for years. Uber and Lyft classify their drivers as independent contractors, which means the workers pay for expenses, such as gas, car maintenance and insurance. Drivers also don’t have benefits like health care and sick leave. Over the last year, as California and other states have pushed for more benefits and rights for drivers, the move toward reclassifying drivers as employees has come center stage.

Last Thursday, Judge Schulman heard from Uber and Lyft’s attorneys, as well as a representative for the state. At that time, it wasn’t clear how he was going to rule and he appeared to be grappling with how his decision would effect drivers and passengers throughout the state.

READ MORE: COVID Vaccines: 50% Of Eligible Adults Fully Vaccinated In Sonoma County

Uber and Lyft’s lawyers said that while drivers are crucial to ride-hailing, they’re not core to the companies’ businesses. Uber’s lawyer said the company is a technology platform, not a transportation provider.

In his decision on Monday, Schulman disagreed.

“To state the obvious, drivers are central, not tangential, to Uber and Lyft’s entire ride-hailing business,” he wrote.

Uber and Lyft have decided to take the issue to California voters in November. In a ballot measure sponsored by the companies, along with Doordash, Instacart and Postmates, the companies are seeking a carve out to AB 5. In all, the companies have put $110 million behind the measure, called Proposition 22.

CONTINUE AT CNET: California Judge puts Brakes on Ride-Hailing Companies

MORE NEWS: Grandparents, Grandkids Share First Hugs Since Pandemic At Palo Alto Retirement Community

© CBS Interactive Inc. All Rights Reserved