A federal judge Monday tossed out two groundbreaking lawsuits by San Francisco and Oakland that sought to hold some of the world’s largest oil companies liable for climate change.

In an exhaustive, 16-page ruling that touched on such scientific matters as the ice age and early observations of carbon dioxide, U.S. District Judge William Alsup acknowledged the problem of a warming planet but said it is just too big for the courts to solve.

The cities are trying to get five oil and gas giants, including Bay Area-based Chevron, to help cover the costs of dealing with sea-level rise, like picking up the tab for seawalls. However, Alsup, noting that Congress and the White House, not the judiciary, are responsible for addressing the fallout from fossil fuels, granted the industry’s request to dismiss the suits.

“The problem deserves a solution on a more vast scale than can be supplied by a district judge or jury in a public nuisance case,” he wrote.

The two cases are among the first of many nationwide that have recently attempted to force the oil industry to pay for what might amount to hundreds of billions of dollars to combat climate change. While the other municipalities, including a handful in California as well as New York City and Kings County, Wash., are closely following what happens in the Bay Area, Monday’s decision does not affect the cases in other courts.

The cities and counties all claim that oil companies have long known that greenhouse gas emissions from fossil fuels are warming the planet. Yet, according to the suits, the industry did nothing to prevent problems and even sought to cover up its ties to the climate, akin to how big tobacco tried to deceive the public about the health impacts of cigarettes decades ago.

The lawsuits argue that like tobacco companies, the oil firms create a public nuisance and should be held accountable. San Francisco alone estimates that rising seas at the hands of climate change has put $10 billion of public property and as much as $39 billion of private land at risk.

But Alsup, who works in the court’s Northern District of California, opined that the world has undoubtedly benefited from fossil fuels, from the industrial revolution to today’s modern conveniences. The bench, he determined, was not in a position to weigh the industry’s positives against the negative.

“Having reaped the benefit 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?” he wrote. “Is it really fair, in light of those benefits, to say that the sale of fossil fuels was unreasonable?”

Alsup tried to grapple with such questions at a first-of-its-kind climate “tutorial” in March. He invited experts from both sides of the case to weigh in on the science of climate change. The hearing was so popular that it had to be live-streamed to an additional courtroom.

In the end, Alsup determined that the nation’s environmental agencies should be tapped for their expertise on the subject and that the legislative and executive branches of government should have final say.

Attorneys for San Francisco and Oakland are reviewing their options and are not yet ready to concede defeat.

“Our belief remains that these companies are liable for the harm they’ve caused,” said John Coté, spokesman for the San Francisco City Attorney’s Office. “This is obviously not the ruling we wanted, but this doesn’t mean the case is over.”

Besides Chevron, the targets of the lawsuits were BP, ConocoPhillips, ExxonMobil and Shell.

The National Association of Manufacturers, which represents the interests of the oil industry, praised Alsup’s action.

“From the moment these baseless lawsuits were filed, we have argued that the courtroom was not the proper venue to address this global challenge,” said the association’s president and CEO, Jay Timmons.

Attorneys for the oil companies have long maintained that greenhouse gas emissions from fossil fuels are regulated under the Clean Air Act and remain the purview of lawmakers and the president.

While the San Francisco and Oakland cases are the first of the recent climate suits to get a decision, the others are in different courts, both at the state and federal level, and could elicit different judgments.

San Mateo and Marin counties are both trying to get climate suits heard in California court, where public nuisance cases are generally easier to make.

San Francisco and Oakland had initially tried to make their cases in state court, but Alsup determined that because of the scope of the matter, the issue belonged to the federal judiciary.

Kurtis Alexander is a San Francisco Chronicle staff writer. Email: kalexander

@sfchronicle.com Twitter: @kurtisalexander