When a federal judge dismissed lawsuits by San Francisco and Oakland seeking to hold major oil companies responsible for harm caused by climate change, he said the issue was one for the political branches of government, not the courts.

The problem with that reasoning, according to a half-dozen Democratic senators — including California’s Dianne Feinstein and Kamala Harris — is that the oil giants have used their financial might to make a political solution impossible.

“The fossil fuel industry, led by (the five major oil companies), has weaponized the power of unlimited political spending granted to it by Citizens United (the 2010 Supreme Court ruling) to prevent the debate, consideration, and passage of legislation to limit carbon emissions,” the senators told a federal appeals court in a filing last week.

The five companies — BP, Chevron, ConocoPhillips, ExxonMobil and Shell — have spent nearly $40 million a year lobbying the federal government for the last two decades, much of it fighting legislation and regulations that would have limited fossil fuel extraction and carbon emissions, the senators said.

By also opposing judicial action, they said, the companies showed that their “real position is that no one should address climate change.”

The filing in the Ninth U.S. Circuit Court of Appeals in San Francisco supported appeals by the two cities to reinstate the suit that U.S. District Judge William Alsup of San Francisco dismissed. Besides Feinstein and Harris, the brief was signed by Sens. Sheldon Whitehouse of Rhode Island, Richard Blumenthal of Connecticut, Mazie Hirono of Hawaii and Edward Markey of Massachusetts.

The lawsuit, one of several by local governments in California and other states, contends oil companies have long known that emissions from their operations are heating the planet, but have sought to hide their connection while doing nothing to solve the problem.

Likening the oil giants to tobacco companies that denied their products caused cancer, San Francisco and Oakland seek to require the five companies to pay some of the costs of rising sea levels, like building seawalls. San Francisco’s lawyers say $10 billion worth of publicly owned property and as much as $39 billion of private land is at risk from swelling seas.

In dismissing the suit in June, Alsup said the courts were not qualified to weigh the future dangers of fossil fuel extractions and emissions against the fuels’ past and present contributions to society, dating back to the industrial revolution.

“Having reaped the benefits of that historic progress, would it really be fair to now ignore our own responsibility in the use of fossil fuels and place the blame for global warming on those who supplied what we demanded?” the judge asked. He said it was a question properly directed to policymakers in Congress and the White House.

The cities’ appeal, to a yet-unnamed Ninth Circuit panel, raises political and environmental as well as legal issues, as reflected in a proliferation of supporting briefs:

• Former government officials, including ex-Secretary of State John Kerry, National Security Adviser Susan Rice and Environmental Protection Agency Administrator Gina McCarthy, arguing that judicial review of oil companies’ actions would not interfere with U.S. diplomacy or foreign policy.

• Attorneys general of California and 10 other states, disputing Alsup’s decision to grant the oil companies’ request to transfer the cities’ lawsuits to federal court from Superior Court, where they were filed. Alsup said the case raised issues of national policy, but the states said San Francisco and Oakland were properly invoking state laws that protect public health. Similar arguments were made in separate briefs by the California State Association of Counties and the National League of Cities.

• The Union of Concerned Scientists, and individual climate scientists, arguing that oil companies are major sources of planet-warming greenhouse gases and have worked to conceal their role and to discredit scientific research.

The filing by the six Democratic senators focuses on political machinations, such as Big Oil’s alleged efforts to use “front groups” to derail climate-protection measures.

For example, they said, the five oil companies were among the founding members in 1989 of the Global Climate Coalition, which took the position — contrary to the views of the oil industry’s own scientists — that there was “no convincing evidence” that increases in greenhouse gas emissions would significantly affect the climate.

When Sens. John McCain, R-Ariz., and Joseph Lieberman, D-Conn., introduced legislation in the 2000s to limit carbon emissions, the brief said, the oil industry “launched a nominally independent campaign, entitled ‘United for Jobs,’ to build public opposition to these bills,” which failed to pass.

And when President Trump announced U.S. withdrawal in 2017 from the Paris Agreement on climate change, the senators said, all five oil companies publicly opposed the withdrawal, while privately supporting a “flawed economic analysis,” funded by the industry-subsidized U.S. Chamber of Commerce, that justified Trump’s action.

“For public relations reasons, it is exceedingly difficult for (the oil companies) to openly oppose climate action,” the brief said. “If their CEOs want to be able to jet off to Davos and hobnob with the global elite, they can’t engage in flagrant climate denial.

“But at the same time, any effort to reduce carbon emissions has been viewed as representing a threat to (their) future revenues, so they have found ways to mask their opposition to legislation that might jeopardize their business model.”

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com Twitter:@BobEgelko