(Reuters) – Voters in trendsetting California backed a ballot proposal by Uber and its allies that cements app-based food delivery and ride-hailing drivers’ status as independent contractors, not employees, according to a projection by data provider Edison Research.

Victory in the most expensive ballot contest in state history is a rebuke to state legislators and allows Uber, Lyft, and allies to set the employment terms of the gig economy they helped create.

The measure, known as Proposition 22, marked the culmination of years of legal and legislative wrangling over a business model that introduced millions of people to the convenience of ordering food or a ride with the push of a button.

Companies described the contest as a matter of ensuring flexibility for a new generation of workers who want to choose when and how they work. Opponents saw it as an effort to exploit workers and avoid employee-related costs that could amount to more than $392 million each for Uber and Lyft, a Reuters calculation showed.

Uber, Lyft, DoorDash, Instacart, and Postmates, several of which threatened to shut down operations in California if they lost, poured more than $205 million into the campaign.

After Edison made the projection, state figures showed the measure ahead 58% to 42%, with two-thirds of precincts at least partially reporting. These results are incomplete and must also be certified.

“I’m so, so happy. I know it’s right for the drivers, and I know it’s right for the people who use the services,” said 62-year-old retiree Jan Krueger, who drives part-time for Lyft in Sacramento and got a “Mom Lyft” tattoo on her shoulder.

The proposition was the app makers’ response to a new California law requiring companies that control how workers do their jobs to classify those workers as employees.

The app companies argued that California’s law did not apply to them because they are technology platforms, not hiring entities, and their drivers control how they work.

Companies warned they could cut 80% of drivers, double prices, and even leave California if they were forced to pay benefits such as minimum wage, unemployment insurance, health care, and workers’ compensation.

Uber, Lyft, DoorDash, Instacart, and Postmates challenged the new law in court, but judges have so far ruled against them. Uber and Lyft recently lost an appeal that would have narrowed their options if Prop 22 had failed.

California represents 9%, or roughly $1.63 billion, of Uber’s 2019 global rides and food delivery gross bookings and around 16% of Lyft’s total rides.

Prop 22 leaves gig workers as contractors and provides them more modest benefits than are required under state law, including minimum pay while riders are in their cars, health care subsidies, and accident insurance.

Not all drivers favor the contractor model. Los Angeles Uber driver Christine Tringali said the companies’ actions were shameful.

“How can someone fight so hard to avoid paying people a living wage and giving them job security?” Tringali said ahead of the vote.

The California battle was just one of many around the country and the world.

U.S. states such as Massachusetts and New York are challenging gig companies’ labor policies. The European Union’s highest court in 2017 held that Uber is a transport service to be regulated like taxi companies, not a technology platform that connects riders with drivers — opening the door for challenges there.