California’s cities and counties will be barred from adopting soda taxes for the next 12 years under a legislative deal that marks a big victory for the influential beverage industry — one that state lawmakers said holds Californians “hostage.”

On Thursday, the state legislature rushed to approve the last-minute, quid pro quo deal between one of the state’s largest labor unions and the American Beverage Association. Democratic Gov. Jerry Brown signed the measure shortly after the vote.

The bill gives the industry a reprieve in California from any future local soda taxes until Jan. 1, 2031. In return, cities and counties will avoid a costly fight at the ballot box on a broader proposal that could have made it more difficult for them to raise general taxes and fees.

It was a vote that several frustrated lawmakers described as a reluctant but necessary choice that will safeguard city and county revenues.

“The industry is aiming basically a nuclear weapon at government in California and saying, ‘If you don’t do what we want, we’re going to pull the trigger and you’re not going to be able to fund basic government services,'” said state Sen. Scott Wiener (D-San Francisco). “This is a ‘pick your poison’ kind of a situation.”

Backers of the initiative, which would have made it harder for local governments to raise taxes, had until Thursday to pull their measure off the November ballot, an election-year deadline that required lawmakers to act quickly and rush a deal crafted over the weekend to votes this past week.

In a message he sent after signing the bill, Brown called the barely averted ballot initiative “an abomination.” He said he had heard from the mayors of “countless cities,” who had called “to voice their alarm and to strongly support the compromise which this bill represents.”

The initiative, called the Tax Fairness, Transparency and Accountability Act of 2018, was sponsored by the American Beverage Association. It sought to increase the voter threshold for cities and counties to levy taxes and fees from a simple majority to a two-thirds vote. It also would have required a two-thirds majority for tax and fee votes by local governing bodies, such as city councils and county boards.

It was a tactic intended to make it harder for cities to get the votes for new taxes on soda, which has been a growing target of public health advocates and local governments across the country. But the initiative also would have affected new taxes and fees for libraries, public safety and other government services, triggering fears among local governments and unions that they might not be able to raise the revenue they need in the future.

In a statement, the American Beverage Association said the legislature’s decision would “provide protections for working families, our customers and our consumers” and keep the cost of beverages and other groceries affordable in California.

In the past few years, voters in Albany, Berkeley, Oakland and San Francisco have passed local soda taxes, steering new tax revenues to public health programs and denting soda revenues. In Berkeley, for example, sales of sugary beverages fell by 9.6 percent in one year, according to one study. But the industry so far has thwarted legislative efforts to pass statewide soda taxes and require health warning labels.

Studies have found that sugary drinks can increase the risk of Type 2 diabetes, heart disease and other chronic health conditions, with the American Diabetes Association recommending people avoid soda, fruit and energy drinks, and sweet tea.

Soda taxes “are one of the most effective tools communities have to reduce the consumption of sweet and sugary beverages,” said Juliet Sims, program manager at the Prevention Institute, a nonprofit based in Oakland that promotes community health solutions. “When soda taxes are proposed, the industry will spend tens of millions to oppose them.”

The beverage association said it understands that obesity is a serious health issue and is “committed to working with government, public health and others to find better ways to help consumers reduce sugar consumption.”

Under the terms of the Capitol deal, existing soda taxes will remain in place if they were adopted before January 2018.

The American Beverage Association had poured $7 million into the “tax fairness” initiative since January, according to filings with the secretary of state. By comparison, opponents including the Service Employees International Union California and the California League of Cities gave just slightly more than half a million dollars to defeat it. SEIU California Executive Director Alma Hernandez said the initiative would have compromised local emergency services, parks, libraries and other crucial community investments.

“A temporary pause on further local soda taxes gives California the opportunity to work on a statewide approach to the public health crisis of diabetes,” Hernandez said in a written statement.

A January analysis by the Legislative Analyst’s Office found that roughly half of the tax measures enacted by local voters since 2012 would not have passed if they had required a two-thirds vote under the initiative.

“This would make it harder for local governments to raise revenue. Their finances would be more constrained if the measure were to pass,” Ryan Miller, a fiscal and policy analyst at the LAO, said before the vote. “The effect on local governments could be substantial.”

Some Republican lawmakers, however, voted against the deal because they viewed the initiative and its two-thirds voting requirement as a welcome proposal. They decried its removal from the ballot as a “backroom deal” that favors one industry.

“The higher vote threshold means members of your community are in agreement and they see [taxes] as a priority,” Sen. Joel Anderson (R-Alpine) argued during Thursday’s floor debate.

The deal was a classic, election-year political maneuver often used to force the legislature to act, prompting state Sen. Bill Monning (D-Carmel) to complain during a committee hearing earlier in the week that the ballot process had been “abused by one special interest” that had now insulated itself from future taxes.

“I’m referring to big soda, the big soda industry that … uses that extraordinary monetary and economic influence to hold the citizens of California hostage,” Monning said.