California’s Assembly Bill 5 just went into effect. With some exceptions, the law takes aim at the new gig economy and independent contractors, forcing businesses to choose between hiring contractors as employees or laying them off.

A week before Christmas, Vox Media’s SB Nation, a sports website, sent notice to some 200 of its California-based freelancers that they would no longer be allowed to be paid for their pieces—the new law stipulates that any freelance writers who contribute more than 35 pieces a year must be employees. So SB Nation is ditching its independent contractors in California.

An even more consequential battle over the law is taking place in the courts, where a federal judge issued a temporary restraining order on behalf of the California Trucking Association and its 70,000 independent truckers. The judge is considering a permanent injunction on the basis that the wide-ranging California labor law violates federal law as it pertains to the trucking industry, much of which engages in interstate commerce.

There are two main beneficiaries to the California law: unions and trial attorneys. Backers of the law contend it is needed to help workers in the gig economy unionize. Union money is a lifeblood of California politics. And so are donations from the state’s powerful trial bar.

In an attempt to overturn the law, Uber and Postmates, exemplars of the gig economy, have sued, claiming the law is unconstitutional as it unfairly targets “workers and companies in the on-demand economy” while offering “nonsensical” exemptions for “direct salespeople, travel agents, grant writers, construction truck drivers” and others.

Some labor law analysts have claimed that California’s new law packs a bark worse than its bite, noting that it is no different than a law that’s been on the books for more than a decade in Massachusetts, which has seen little disruption of its gig economy. In Massachusetts, as now in California, the law applies a three-part test, also known as an ABC test, on whether a contractor is really an employee: Are they free from direct control of the company? Do they perform work outside of the firm’s usual business? And is the person’s main occupation the same as the work they’re doing for the business?

But California isn’t Massachusetts. While both states’ political culture are progressive liberal, with strong Democratic supermajorities in each of the states’ two houses of the legislature, there is a key difference: the courts. The U.S. Chamber of Commerce’s Institute for Legal Reform ranks all 50 states’ lawsuit environment. In 2019, Massachusetts ranked as the 28th-most fair state, down from 14th in 2017. California ranked 48th in 2019, just above Illinois and Louisiana.

Importantly, many of the companies in the burgeoning gig economy are headquartered in the San Francisco Bay Area or in Southern California. The Institute for Legal Reform’s nationwide survey conducted by The Harris Poll found that on the city and county level, the three worst lawsuit environment areas in the nation are Chicago/Cook County, Los Angeles and San Francisco.

Further, California ranked in the worst five states in each of the following key parameters: trial judges’ impartiality, trial judges’ competence, juries’ fairness, and quality of appellate review.

Thus, the new California anti-freelancer law doesn’t exist in a vacuum, but rather is born into a toxic synergy of a highly litigious state with biased judges and juries, and a dysfunctional appeals process.

As a result, California companies are expecting a flood of litigation. Last summer, a day after the AB 5 passed the legislature, a lawsuit was filed on behalf of Uber drivers claiming wage and other labor law violations. The lawsuit even cited the yet-to-be-signed law. A wide range of industries beyond ride sharing is expected to be caught up in the new law’s mandate. Of worry is that the legal landscape regarding worker classification is already very complex in California, with AB 5 providing fresh approaches for labor law violation litigation.

Should drivers for Uber and Lyft gain employee status, it would cost the ride sharing firms up to $3,600 per driver every year—totaling as much as $500 million for Uber alone.

A large part of California’s economic recovery since the recession has been due to the private equity-fueled innovations of Silicon Valley. AB 5 strikes at the heart of a large share of those innovations.

While California has a high cost of living, the nation’s highest poverty level, and some half of all of America’s unsheltered homeless population, politicians in the Golden State could always point to Silicon Valley and claim, with some good measure, that their state was a global innovation hub. AB 5 may threaten some of that success, just as the state grapples with another blow to its self-esteem—the U.S. Census Bureau announced on Monday that, for the first time ever, California is expected to lose a congressional seat in the 2020 reapportionment. In addition to a slowing international immigration rate and declining birthrate, a big driver of the loss of clout in the U.S. House of Representative is that California lost a net of 203,414 people to other states between 2018 and 2019, about double its usual yearly loss over the past decade.

The big beneficiary of California’s loss? Texas, which is expected to pick up three congressional seats in 2020 while Arizona, Colorado, and Oregon are looking to gain one seat each. All four states feature a far lower tax and regulatory burden, as well as a better lawsuit climate than does California.