SAN FRANCISCO — Gov. Jerry Brown signed a landmark bill Tuesday extending California’s signature climate change policy and capping a major legislative victory that drew support from both parties.

Standing on Treasure Island with a backdrop of downtown San Francisco, Brown painted the bill in generational terms, saying California was filling a leadership void on climate policy left open by President Donald Trump.

“The gravity of this topic is so great that it’s hard to talk about it,” he said. “If we don’t do something about it, it is the end of the world as we know it.”

The bill, AB398, will extend California’s cap-and-trade system from 2020 to 2030. The system requires refineries, power plants and factories to acquire permits for each ton of greenhouse gases they emit, reducing emissions and raising revenue for other climate change policies.

Brown was flanked by former Gov. Arnold Schwarzenegger, who signed the state’s original cap-and-trade bill in 2006 at the same spot on Treasure Island — when the San Francisco skyline was notably shorter. He described the bipartisan process that led to a cap-and-trade deal as the opposite of the gridlock and acrimony in Washington.

“We have a functional government here in California where Democrats and Republicans work together,” said Schwarzenegger, who wore a green tie. “This is a very important message for Washington, where both of the parties cannot work together — I hope they learn something from this.”

The former movie star also attacked Trump, with whom he’s repeatedly sparred, for dropping out of the Paris climate agreement. He said the U.S. would continue to meet its commitments to reducing carbon dioxide emissions: “It’s only one man who dropped out, but America did not drop out,” Schwarzenegger said.

The cap-and-trade deal brought together a rare coalition of environmentalists, agriculture interests, business groups and even the oil industry. It was the product of “long, arduous, and painstaking negotiations,” said Senate President Pro Tem Kevin de León, D-Los Angeles, calling it a “unicorn.”

The final bill includes tax cuts and prevents local air regulator boards from setting their own rules on emissions that go above and beyond the cap-and-trade program. A companion bill, AB 617, due to be signed in Los Angeles later this week, will establish a program to measure and address air quality in the state’s most polluted neighborhoods, a top priority for environmental justice advocates.

Brown had fought hard for the deal, which needed a two-thirds vote in both houses of the legislature. At one point it appeared that Brown, who had crisscrossed the world to ink climate deals abroad, wouldn’t be able to pass one in his own backyard.

“A few weeks ago, it did not look like it could happen,” Brown said Tuesday. “It’s a little bit of mystery” how it came through, he said.

California’s cap-and-trade system should be a model for other states and countries, Brown argued, saying that China and several Canadian provinces were already following suit. “We are a nation-state in a globalizing world,” he said, calling cap-and-trade “one of the key milestones in turning around this carbonized world into a decarbonized, sustainable future.”

Many speakers heralded the bipartisanship that led to the deal, which passed thanks to the support of seven Republicans in the State Assembly. (One Republican in the State Senate also voted for it.)

But the Republican Assembly Minority Leader, Chad Mayes, R-Yucca Valley, faced a backlash from party activists — and accusations of a marital affair — after he delivered the votes for the bill. Mayes was notably absent at Tuesday’s event.

The attacks against Mayes show “the cannibalistic nature of the Washington Republican Party that has affected so many California Republicans — that you can never engage or discuss or negotiate with Democrats,” de León said in an interview. In California, he said, “we govern like adults, not like the petulant children that we see across the country in Washington.”

Critics of the cap-and-trade bill said it was too costly and would raise gas taxes. “This is a sad, sad day for California taxpayers, California residents and California voters,” said Harmeet Dhillon, a Republican national committeewoman in San Francisco. “It is not bipartisanship when one side gets what it wants completely.”

There are still some unanswered questions about the long-term effects of the cap-and-trade deal. As a compromise with Republicans, the deal includes a constitutional amendment that would give the minority party more say on how the cap-and-trade revenue is spent. But there’s no guarantee that the amendment will be approved by voters next year.

The next big climate policy push in the state Legislature will be SB100, a bill that would require the state to receive all of its power from renewable sources by 2045.