A California judge late Monday granted the state of California a preliminary injunction against Uber Technologies (UBER -2.03%) and Lyft (LYFT -3.43%), telling the rideshare companies to comply with a state law requiring them to classify drivers as employees.

The state, along with a number of California's largest cities, sued earlier this year to enforce a new California labor law that prohibits so-called "gig economy" companies from relying on contractors that aren't entitled to the benefits full-time employees normally enjoy.

Uber has estimated that complying with the law would require it to raise prices by as much as 30% in San Francisco and to more than double prices in more remote areas.

A rideshare customer opens an app in a car.

Image source: Getty Images.

Superior Court Judge Ethan Schulman in a ruling late Monday first reported by Bloomberg Law agreed with California that Uber and Lyft are in violation of California Assembly Bill 5, which said workers can only be considered contractors if they perform duties outside of the usual course of a company's business.

The judge paused the injunction for 10 days to give the companies time to appeal the decision.

The ruling could have serious implications for the business models of Uber, Lyft, and other tech companies that rely on contractors. The companies are struggling to make money even under the current contractor setup and can ill-afford the expense of adding thousands to their payrolls during a potential extended economic downturn.

Uber CEO Dara Khosrowshahi, perhaps in anticipation of the judge's ruling, on Monday wrote an oped in The New York Times calling for the U.S. to rethink labor laws and to find "a third way" between full-time employees and contractors that better fits the gig economy model.