Passed by voters in 2020, the ballot measure classifies Uber and Lyft drivers as independent contractors rather than as employees.

The California Supreme Court ruled on Thursday to uphold a four-year-old ballot measure that classifies Uber and Lyft drivers as independent contractors rather than as employees.

In a win for ride-hailing companies, the decision ends a yearslong legal dispute that could have reshaped California’s gig economy if the ruling had been overturned.

The ballot measure, Proposition 22, was first passed by state voters in 2020. It was overturned in 2021 by a California Superior Court judge, only to be upheld by three appeals court judges last year. The ruling means that Uber and Lyft can continue to operate in the state as usual, and the hundreds of thousands of drivers who work for both services will continue to be classified as independent contractors.

Opponents of Proposition 22 argued that it was unconstitutional because it would limit the state legislature’s ability to oversee workers’ compensation. Gig companies spent $200 million supporting the measure, which maintained the contractor classification for drivers while conceding some benefits like health care stipends and accident insurance.

Hector Castellanos, a gig worker and a plaintiff in the case, condemned the court’s decision. In a statement, he called Proposition 22 a “bait and switch” that comes “at the expense of the Black, brown and immigrant workers.”

Uber, Lyft and the delivery service DoorDash all cheered the decision, saying that the measure maintains flexibility for gig workers and guarantees them some benefits.

“Whether drivers or couriers choose to earn just a few hours a week or more, their freedom to work when and how they want is now firmly etched into California law,” Noah Edwardsen, an Uber spokesman, said in a statement.

While the ruling was an expected defeat for labor activists, the judges left open potential challenges to Proposition 22, said Veena Dubal, a professor at the University of California, Irvine School of Law.

The ongoing fight for increased pay and benefits for gig workers is “a political and moral issue, more than a legal one,” Ms. Dubal said. She added that while places like the European Union have worked to create a presumption of employment for gig workers that extend them additional rights, “California has gone the opposite direction.”

If the proposition had not been upheld, Uber and Lyft could have been sued for misclassifying their drivers. The solution would most likely have been some kind of fleet system in which full-time employees operated Ubers and Lyfts, but it’s unclear exactly what that would have looked like.

The decision comes amid a national push by labor groups and gig workers for higher wages and increased benefits. Gig workers have so far seen increased minimum pay legislation enacted in New York City, Massachusetts, Washington State and Minnesota, but no legislation has included employee reclassification.