California lawmakers voted Monday to renew the state’s milestone climate legislation, ending uncertainty about the fate of a cap-and-trade program criticized by both liberals and conservatives.

After lengthy hearings, the California Senate and Assembly passed the bill, AB 398, which will extend the state’s cap-and-trade program. Since 2012, it has enforced limits on carbon emissions and required polluters to obtain permits to emit greenhouse gases. The program’s goals ― bringing emissions down to 1990 levels by 2020 and achieving an 80 percent reduction of that by 2050 ― are among the most aggressive climate change-curbing efforts in the U.S.

The legislation now goes to the desk of Gov. Jerry Brown, one of the bill’s champions.

The bill required a supermajority in both houses to move forward. It passed with 28 votes in the Senate, one more than was necessary. Republican Sen. Tom Berryhill (R-Modesto) was the lone Republican Senator to cast a vote in favor of the legislation. It passed Monday evening with 55 votes in the Assembly, one more than the 54 required.

“If cap and trade falls apart, that will send a very negative message to the rest of the world,” Sen. Scott Wiener (D-San Francisco) said in support of the bill before Monday’s vote.

The program would have collapsed in 2020 without lawmakers voting to renew it. Gov. Jerry Brown sought to ensure its expansion until 2030, making it clear that California will continue the fight against climate change in spite of President Donald Trump reneging on national commitments to it. In the face of Trump backing out of the Paris Agreement on climate change and going “AWOL” on the subject, Brown said earlier this month that California will host its own climate summit next year.

“Cap-and-trade is the way forward,” Brown said in an impassioned speech at a hearing for the bill Thursday. “I know we’ve got politics; they have everybody on different sides. This is fundamental,” he said, calling climate change a “threat to organized human existence.”

This isn't about some cockamamie legacy. This isn't for me, I'm going to be dead. It's for you & it's damn real #ExtendItNow #CapandTrade 🌍 pic.twitter.com/dAs5GD40Sz — Jerry Brown (@JerryBrownGov) July 13, 2017

Brown warned of a future where the massive wildfires ravaging the state in recent weeks and other climate-caused catastrophes are the new normal. More than a dozen wildfires have scorched California in recent days, including the ever-growing Whittier fire in Santa Barbara County, which has burned more than 18,000 acres since igniting more than a week ago. Wildfires this catastrophic, scientists warn, will only become more frequent as global temperatures rise.

“You’re going to be alive in a horrible situation where you’re going to see mass migrations, vector diseases, forest fires, Southern California burning up,” he urged. “That’s real, guys. That’s what the scientists of the world are saying. I’m not here about some cockamamie legacy that some people talk about. This isn’t for me. I’m going to be dead. It’s for you.”

Brown sought to pass the legislation with a super-majority, or two-thirds, vote in order to protect the program from future legal threats. But achieving that was an uphill battle, even as Democrats control the legislative body. With Assemblywoman Jacqui Irwin (D-Thousand Oaks) out all week, The Los Angeles Times noted, cap-and-trade’s security hinged on winning at least one Republican vote.

While many GOP lawmakers opposed the bill’s taxes and increased regulatory efforts, securing some Republican votes was not out of reach. However, lawmakers on both sides of the aisle faced pressure from environmental justice groups, which say the bill is too friendly to the oil industry and doesn’t go far enough to protect citizens from pollution.

“Governor Brown wants to give the oil and gas industry a pass to pollute for another decade,” Food & Water Watch California director Adam Scow said in a statement to HuffPost. “This bill, that is supported by Sempra Energy and the fossil fuel industry, makes a mockery of California’s climate leadership,”

Opposition to the bill largely centered on the limits it imposes on the state’s Air Resources Board and its ability to protect people who live near pollution sites. Under AB 398, the board would not be allowed to regulate carbon emissions from sources that are subject to the cap-and-trade program.

WANG ZHAO via Getty Images Brown, increasingly the face of the U.S. climate efforts abroad, attends the Clean Energy Ministerial international forum in Beijing on June 6, 2017

But Brown said letting cap-and-trade take the lead and avoiding “intrusive commanding control” from the Air Resources Board is essential for ensuring climate change efforts stay affordable and avoiding the short-term consequences of higher gas and food prices.

AB 617, a companion bill that requires upgrades for outdated equipment and creates stricter penalties for violations, addresses some of those concerns, but critics say it doesn’t undo the problems caused by AB 398. AB 617 also passed the Senate on Monday.

The Natural Resources Defense Council is one of the environmental groups that supported the bill, despite such limits on the Air Resources Board and other concessions to the gas and oil industry being “bitter pills” to swallow. They’re joined by the Environmental Defense Fund and NextGen Climate, among other groups.

“[O]n balance the package ensures our emissions limits are enforceable against polluters and secures critical gains to improve air quality for millions of Californians,” Alex Jackson, the legal director of group’s California climate project, said in a statement last week. “The world is watching for California to chart a path through the climate denial and obstruction coming from the White House – and California is yet again poised to deliver.”

This article has been updated to include the Senate and Assembly votes.

CORRECTION: A previous version mistakenly identified the Coalition for Clean Air as being against AB 398.