Gov. Brown's climate change deal was a lesson in compromise that should be studied in the White House.

One particular message to the agriculture industry was simple: You want Gov. Jerry Brown to be a friend or an enemy the rest of his term?

Friends will support his climate change legislation, it was made clear.

To business leaders: This legislation provides tax and regulatory breaks that you’ve long sought. Grab them now or forget it.

To agriculture and business: You don’t like this cap-and-trade program? Wait until you see what replaces it if it’s not extended.

Brown’s hardball messages, his willingness to compromise and personal dealings with lawmakers were persuasive enough for him to win arguably his biggest legislative victory as governor.

It was a model of how to finesse controversial bills through a Legislature. And it stood in stark contrast to the bumbling we’ve been watching in the White House and Congress, most notably the failed, humiliating efforts on healthcare.

Negotiating disputed legislation when a supermajority vote is needed takes persistence, a willingness to give and the knowledge of when to draw the line. Cajoling and coercion.

Neither the left nor the right can get everything they want. Preachers can demand purity, but it’s a losing cause for politicians. Purity isn’t possible in a legislative brawl.

One example: Pope Francis is a climate change purist. Cap and trade is bad, in his mind. “In no way does it allow for the radical change which circumstances require” to slow global warming, he wrote in 2015. “Rather, it may simply become a ploy which permits maintaining the excessive consumption of some countries and sectors.”

But Francis doesn’t have a vote in the Legislature. And neither do enough environmental purists to have their way.

The merits of Brown’s cap-and-trade legislation are not the point here. Many Republican conservatives complain that it’s just another tax hike on consumers. Democratic liberals grouse about a giveaway to big oil. Supporters — the vast majority of legislators — proudly proclaim that California is showing the world how to save the planet.

All that is irrelevant to the point. The point is that we just witnessed how complex, contentious legislation is passed — how politicians can avoid gridlock, do something and not just whine.

Perhaps part of the credit should go to two political reforms that California voters approved several years ago and are starting to have a moderating affect on legislators.

One reform was the elimination of partisan gerrymandering of legislative districts. The other was the open primary that allows voters to choose any candidate, regardless of party. Unfortunately, partisan redistricting and closed primaries still dominate most of the nation’s congressional districts.

What California’s big vote on climate change policies means for you>>

The cap-and-trade legislation extends California’s climate change program until 2030. It was slated to expire in 2020. A cap is imposed on an industry’s greenhouse gas emissions. But companies can buy extra permits to pollute from the state or private parties. The caps are gradually lowered and emissions, theoretically, are reduced.

The dilemma for polluters is that Brown and the Legislature last year set a new target of reducing greenhouse gas emissions by 40% under 1990 levels. The target is supposed to be reached by 2030. The old target was the 1990 level by 2020, and it has already been almost achieved.

The “trade” feature provides polluters with options and flexibility they wouldn’t have if the state just set a “cap.”

Cap and trade, said Assembly Republican Leader Chad Mayes of Yucca Valley, is “better than Soviet-style command and control. Markets are better than the government coercing people into doing things they don’t want to do.”

Updates from Sacramento »

Mayes and six other Assembly Republicans supported the legislation, but 18 opposed it. So it could cost Mayes his minority leadership position, which isn’t worth much anyway. The GOP is relevant in Sacramento only when a supermajority vote is needed, such as with cap and trade.

The state Chamber of Commerce and other business interests strongly supported Brown’s legislation for the same reasons Mayes did.

Much of agriculture also backed it. Brown and his negotiators reminded ag interests that they produce a lot of dirty air in the San Joaquin Valley — methane from dairy cows, pollution from food processing — and are going to need to clean it up in the future. They’ll be looking for state help, principally money, maybe cap-and-trade bucks.

“You can make a friend of the governor or an enemy of the governor,” they were told, according to one insider. “Don’t shoot yourselves in the foot. You’re going to want the governor to look favorably on you in the next year or two.”

Eight Republicans backed Jerry Brown’s climate change bill — here’s what that means for their political futures>>

Republican Assemblyman Devon Mathis of Visalia, whose district is dominated by agriculture, said he didn’t like cap and trade but the alternative was worse.

“All of agriculture is saying we need this,” he told me.

Brown sweetened the deal for many rural legislators by scuttling a hated fire prevention fee that hits 800,000 landowners.

For business, he extended a manufacturers sales tax break until 2030, eliminated a sales tax on renewable energy equipment purchased by power companies and limited regulation of oil refineries.

The wheeling-dealing governor also backed a separate bill to help poor communities clean up their air. And he supported a proposed constitutional amendment that would require a supermajority legislative vote in 2024 to reestablish spending of cap-and-trade revenue. That could jeopardize funding for his bullet train, if it’s still chugging along.

Given political realities, it seems a pretty good compromise — and a guideline for success that should be studied in the White House.

george.skelton@latimes.com

Follow @LATimesSkelton on Twitter

ALSO