Five of the world’s largest oil producers urged a federal judge Thursday to dismiss lawsuits by San Francisco and Oakland that seek to hold the companies liable for climate change, arguing that the issue is one for Congress, not the courts.

San Francisco and Oakland are among a handful of communities nationwide, including New York City and King County, Wash., squaring off over global warming with the fossil fuel industry, and now the Trump administration. An attorney for the Department of Justice stood with industry lawyers in the federal courthouse in San Francisco, echoing their request that the cases be dropped.

The communities accuse the oil industry of knowingly selling products that emit damaging heat-trapping gases, and they’re suing for billions of dollars to address such problems as sea-level rise. The companies counter that greenhouse gas emissions are regulated under the Clean Air Act and remain the purview of lawmakers.

“Global warming is a serious issue, but it’s not one that can be solved by a lawsuit,” said attorney Ted Boutrous, who represents Chevron of San Ramon and also represented ExxonMobil, BP, Shell and ConocoPhillips on Thursday. “The plaintiffs are asking the courts to wade into the clear territory of Congress. To say the least, that’s a big ask.”

Boutrous not only argued that the nation’s environmental laws are the proper way to deal with industrial emissions, but also said that if a judge takes up the matter of fossil fuels, the court would be reaching too far into issues of national energy policy and national security, topics best handled by Washington.

After nearly three hours of arguments, U.S. District Judge William Alsup did not rule on whether the lawsuits would move forward. He asked both sides for more information. In addition, he authorized the cities to collect information from the out-of-state oil companies, which also argued that liability for California issues shouldn’t extend beyond the state’s border.

The San Francisco and Oakland cases are the furthest along of roughly a dozen similar legal efforts and they’re being closely watched across the nation. The suits have put global warming on unprecedented legal ground and have huge stakes for how the localities will cover the rising costs of climate change.

San Francisco alone estimates that $10 billion of public property and as much as $39 billion of private land are threatened by rising seas. The city wants money to repair its seawalls, control drainage, and relocate streets and infrastructure.

“It’s hard to know what’s going to happen with the suits,” said Sean Hecht, co-executive director of the Emmett Institute on Climate Change and the Environment at the UCLA School of Law. “We have not had a case like this that has gotten beyond the motion-to-dismiss phase.”

The attorneys for the oil companies sought to justify their pleas for dismissal with prior court cases. Many of the rulings they cited, including the 2011 decision in American Electric Power Co. vs. Connecticut, found that corporations can’t be sued for greenhouse gas emissions because Congress has laws, as well as the Environmental Protection Agency, to regulate pollutants.

San Francisco and Oakland, however, are making a slightly different legal case than the earlier suits. They’re going after the oil companies not for greenhouse gas emissions but for producing and promoting fossil fuels.

Attorneys for the cities said that putting fossil fuels on the market and encouraging their use, when the companies knew they were damaging, constitutes a “public nuisance” that is within the court’s jurisdiction.

“We’re going to prove that they understood that they were causing global warming and they took actions to harm us,” said Steve Berman, one of the attorneys representing the cities.

The cities have likened the actions of the oil industry to tobacco companies, which sought to cover up research into lung cancer and have been held responsible for the health damage caused by smoking.

While Alsup hasn’t ruled on whether the cases will proceed, he acknowledged in a March decision, which put the matter in federal court instead of state court, that the suits are different than previous emissions cases. He also held an unprecedented “tutorial” on climate science to better prepare the court for handling the cases.

But on Thursday, Alsup questioned whether it makes sense to sue the oil industry for a product most people want and need.

“If we didn’t have fossil fuels, we would have lost that war (World War II) and every other war,” he told the courtroom. “Planes wouldn’t fly. Trains wouldn’t run. And we’d be back in the Stone Age.”

Alsup wrestled aloud with how to reconcile the benefits of fossil fuels with the damage they’re causing, and he wants both sides to provide additional information on the matter.

In a friend-of-the-court brief filed this month, the Justice Department argued that the importance of oil and gas is one of the reasons the issue is not one for the courts to address.

“Balancing the nation’s energy needs and economic interests against the risks posed by climate change should be left to the political branches of the federal government,” the federal attorneys wrote.

The attorneys also argued that if San Francisco and Oakland are successful in their suits, it would invite countless other legal challenges.

“If these cities may properly allege injuries from climate change, then so can every person on the planet,” they wrote. “Federal courts are poorly equipped to handle this multitude of cases and the associated complex scientific, economic, and technical issues.”

Most of the communities that have filed suits like San Francisco’s and Oakland’s are in California, including the cities of Richmond, Santa Cruz and Imperial Beach, and the counties of San Mateo, Marin and Santa Cruz. None have moved to trial. In most of the cases, judges are still deciding whether federal or state court is the appropriate venue.

The lawsuits come as the Trump administration has vowed to withdraw from the Paris climate agreement, an international pact aimed at reducing greenhouse gas emissions. President Trump has often downplayed the threat of climate change, even suggesting that the planet is not warming.

Kurtis Alexander is a San Francisco Chronicle staff writer. Email: kalexander@sfchronicle.com Twitter: @kurtisalexander