CNN Business  — 

Uber and Lyft were ordered by a California court on Monday to reclassify their drivers in the state as employees, marking the latest escalation in an ongoing legal battle over a new law impacting much of the on-demand economy.

The companies will have 10 days before the order takes effect to allow for an appeal, according to a copy of the ruling from San Francisco Superior Court judge Ethan Schulman. Uber and Lyft currently treat their drivers as independent contractors.

The mounting legal pressure to reclassify their workers in the state comes at an uncertain time for both companies. Uber (UBER) and Lyft continue to grapple with the pandemic, which significantly cut demand for their core ride-hailing businesses. Both companies have undergone layoffs and have long histories of steep losses.

According to the court ruling, “now, when Defendant’s ridership is at an all-time low, may be the best time (or the least worst time) for Defendants to change their business practices to conform to California law without causing widespread adverse effects on their drivers.”

In response to the order, Lyft spokesperson Julie Wood said, “drivers do not want to be employees, full stop.”

“We’ll immediately appeal this ruling and continue to fight for their independence. Ultimately, we believe this issue will be decided by California voters and that they will side with drivers,” Wood said in a statement provided to CNN Business.

Representatives for Uber did not immediately respond to a request for comment.

Monday’s order comes after California Attorney General Xavier Becerra and a coalition of city attorneys filed for a preliminary injunction in late June to force the two ride-hailing companies to comply with the California law known as AB-5. The injunction was part of a lawsuit filed in May that alleges the companies are misclassifying their workers in violation of the law.

Under the law, which went into effect on January 1, companies must prove workers are free from company control and perform work outside the usual course of the company’s business in order to classify workers as independent contractors rather than employees.

The lawsuit accuses Uber and Lyft of depriving workers of protections, including a minimum wage, overtime, paid sick leave, and unemployment insurance, that they would be entitled to as employees. Uber, Lyft and DoorDash have each put $30 million behind a ballot initiative, with additional support from Instacart and Postmates, which Uber recently agreed to acquire. If passed, it would exempt them from the AB-5 law, but offer drivers some benefits.

On Monday, The New York Times published an op-ed from Uber CEO Dara Khosrowshahi asking states to pass new laws requiring gig economy companies to establish benefits funds that would give workers cash for benefits such as health insurance or paid time off. “Uber is ready, right now, to pay more to give drivers new benefits and protections,” he wrote. “But America needs to change the status quo to protect all workers, not just one type of work.”

The AB-5 law has long been viewed as a potential existential threat to many gig economy companies like Uber and Lyft, which built up their businesses in large part by treating workers as independent contractors rather than employees. In addition to not receiving certain employee protections, drivers also pay their own expenses, including gas and vehicle maintenance.

Last week, the California’s Labor Commissioner’s Office filed lawsuits against Uber and Lyft for allegedly committing wage theft by misclassifying their on-demand workers as independent contractors instead of employees.

“The vast majority of drivers want to work independently, and we’ve already made significant changes to our app to ensure that remains the case under California law,” said an Uber spokesperson in a statement last week. “When over 3 million Californians are without a job, our elected leaders should be focused on creating work, not trying to shut down an entire industry.”