California just disrupted the gig economy.

Gov. Gavin Newsom signed a controversial bill Wednesday, known as AB 5, after months of uproar from businesses and gig companies like Uber and Lyft. The bill will require businesses to hire workers as employees, not independent contractors, with some exceptions. That will give hundreds of thousands of California workers basic labor rights for the first time.

And despite an aggressive lobbying campaign, Uber and Lyft are not exempt.

Senators voted 29-11 in favor of AB 5 last week, and the state assembly approved their amendments to the bill.

“I am now in a position to earn a living wage,” driver Anette Rivero, a member of Rideshare Drivers United, said in a statement to Vox on Wednesday. “Instead of spending over 50 hours a week on the road, I will be able to spend time with my four children and complete my college degree.”

The new law will crack down on a business model championed and cherished by Silicon Valley — a striking turn of events for the celebrated tech industry. Uber, Lyft, and other app-based gig companies rely on hundreds of thousands of independent contractors to give rides, deliver food, and complete other tasks.

Reclassifying them as employees would change everything.

Gig workers would get labor protections and benefits that all employees get, such as unemployment insurance, health care subsidies, paid parental leave, overtime pay, workers’ compensation, paid rest breaks, and a guaranteed $12 minimum hourly wage. And, perhaps more importantly, they could unionize.

The added cost of these benefits is why gig companies are so desperate for a compromise. They didn’t get one. But that doesn’t mean they won’t keep trying.

“Our state’s political leadership missed an important opportunity to support the overwhelming majority of rideshare drivers who want a thoughtful solution that balances flexibility with an earnings standard and benefits,” an Lyft spokesperson told Vox last week after the senate vote. “The fact that there were more than 50 industries carved out of AB5 is very telling. We are fully prepared to take this issue to the voters of California to preserve the freedom and access drivers and riders want and need.”

Lyft, Uber, and DoorDash have warned that they were each ready to spend $30 million on a ballot initiative to overturn AB 5. California labor unions, which support AB 5, have vowed to fight back.

The tussle between labor unions and Uber — one of Silicon Valley’s most beloved investments — was perhaps the most consequential legislative battle taking place in the country. Newsom’s endorsement of AB 5 was stunning loss for the tech industry and a remarkable victory for labor unions. And the bill’s passage will likely open the door for other Democratic-controlled states to do the same.

California’s AB 5 bill, explained

The California bill, known as AB 5, expands a groundbreaking California Supreme Court decision last year known as Dynamex. The ruling and the bill instruct businesses to use the so-called ABC test to figure out whether a worker is an employee. To hire an independent contractor, businesses must prove that the worker a) is free from the company’s control, b) is doing work that isn’t central to the company’s business, and c) has an independent business in that industry. If they don’t meet all three of those conditions, then they have to be classified as employees.

That is a much clearer — and stricter — standard of proof than the vague guidelines under federal law. And it’s one of the biggest challenges yet to the profit model of Uber, Instacart, Postmates, and other tech companies that rely on a small army of independent contractors. Uber likely will have to reclassify tens of thousands of drivers in California as employees, something Uber drivers have been fighting for in court, unsuccessfully, for years.

Since the bill passed the state assembly in May, California businesses had been panicking over the possibility of it passing. The state’s Chamber of Commerce and dozens of industry groups lobbied for exemptions, and a long list of professions was excluded from the bill: doctors, dentists, lawyers, architects, insurance agents, accountants, engineers, financial advisers, real estate agents, and hairstylists who rent booths at salons.

Uber and Lyft, in particular, had been lobbying for an exemption to the bill in the Senate. They’ve even begged in public for a compromise. The companies hoped to keep treating drivers as contractors, and in exchange, they promised to set a minimum pay rate for drivers while they’re picking up and dropping off passengers, create a company-backed fund for benefits like paid time off, and establish an association for drivers to advocate for further improvements.

Drivers who had been organizing in support of AB 5 hit back with their own messaging, saying nothing in the law would stop the companies from offering schedule flexibility to employees.

That didn’t stop Uber and Lyft from ramping up their campaign to get an exemption. In recent weeks, Uber and Lyft had been emailing drivers and passengers in California, begging them to contact their lawmakers to urge them to compromise.

“Help protect rideshare in California,” read one message sent to Lyft customers on Aug. 28. They were never able to strike a deal.

Ride-hailing apps have done everything to keep drivers as contractors

When Uber drivers went on strike across the world in May, much of their frustration had to do with their lack of power as independent contractors.

Uber’s profit model, like that of other companies in the gig economy, depends on all the money saved from skirting US labor laws.

By classifying drivers as independent contractors instead of employees, Uber hasn’t needed to pay certain taxes, benefits, overtime, or minimum wages to tens of thousands of drivers. As self-employed contractors, drivers haven’t had a legal right to form labor unions or negotiate contracts.

Until now.

Uber drivers have spent more than six years fighting the company in court, saying they’ve been intentionally misclassified. They argued that drivers should be considered employees because the company has so much control over their workday, including strict rules on their vehicle conditions, what rides they can take, and which routes to use.

Over the years, Uber has refused to reclassify drivers, maintaining that drivers are not employees because they set their own schedules and provide their own cars.

However, in May, Uber settled the main court case with 13,600 Uber drivers, agreeing to pay them $20 million but without changing their status as independent contractors. The other 350,000 drivers who were part of the initial class-action lawsuit had signed mandatory arbitration agreements, so a federal judge is requiring them to pursue their cases in a private forum, where they are less likely to win their case.

But it will be hard for Uber to pass the ABC test that will soon become law; driving people around in cars is a central part of the company’s business. Any challenge to the drivers’ status as contractors threatens Uber’s bottom line, which is another reason the bill is so significant.

Uber has been upfront with investors about the risk of a labor revolt. In a recent Securities and Exchange Commission filing, Uber acknowledged that giving drivers the same legal rights as employees would “fundamentally change” the company’s financial model:

If, as a result of legislation or judicial decisions, we are required to classify Drivers as employees ... we would incur significant additional expenses for compensating Drivers, potentially including expenses associated with the application of wage and hour laws (including minimum wage, overtime, and meal and rest period requirements), employee benefits, social security contributions, taxes, and penalties.

So it’s unsurprising that Uber is not happy about a law that would force the company to hire drivers as employees.

As employees, gig workers would have a safety net for the first time ever. The changes from the law will also reportedly benefit the state of California, which estimates that it loses $7 billion in tax revenue each year from companies that misclassify employees. California has the largest state economy in the country and is home to the Silicon Valley tech industry — which means its lawmakers have outsize influence in national politics. The law could lead other states to take similar action.

“Here we are in a great economy and yet most working people have no money saved,” Caitlin Vega, legislative director for the California Labor Federation, told me at the time when the bill first passed the state assembly. “[Companies] are doing this because they can; they’ve gotten away with it.”

For a while, it was unclear whether Newsom would sign AB 5 without a carveout for gig companies. That changed on Labor Day.

“Employers shirk responsibility to safety net programs like workers’ compensation and unemployment insurance. Taxpayers are left to foot the bill,” Newsom wrote in an op-ed piece published Monday in the Sacramento Bee.

The governor’s support for AB 5 cemented Uber’s defeat on the issue.