There is likely to be a titanic legal battle one day between local governments and the fossil-fuel energy companies that officials blame for the climate-change damage they say their cities have suffered.

But the warm-up act at the Supreme Court on Tuesday was the kind of argument only a lawyer could love.

BP v. Mayor and City Council of Baltimore could answer the important question of where a showdown should occur: in state courts, which plaintiffs such as the city consider a more hospitable setting, or in federal court, where the multinational oil and gas companies feel their chances are better.

But the technical question before the court Tuesday was even narrower. It was not about whether an appeals court had been right in saying the case belonged in state court, but whether the appeals court considered all of the arguments raised by the companies.

Climate change itself got only a passing reference, and there was no attempt to ascertain whether the companies should be liable for it.

But Washington lawyer Kannon K. Shanmugam, representing the companies, said the Supreme Court could move the process along by directing that federal court is where such cases should be heard.

He said there are more than 20 cases such as Baltimore’s in courts around the country. “There is something profoundly counterintuitive about the notion that these cases, which seek relief for injuries caused by worldwide greenhouse gas emissions, should be litigated in state courts under the laws of different states,” Shanmugam said.

The Justice Department agreed with the companies, although lawyer Brinton Lucas said the government was not necessarily urging the court ultimately to reach that decision in the case at hand.

Victor M. Sher, a San Francisco lawyer representing the city of Baltimore, said state courts were better suited to consider the kinds of allegations the city has made.

“The conduct complained of is fraud, deception, denial, and disinformation,” Sher said, and those “are traditional state foci and traditional state remedies.”

In July 2018, Baltimore officials filed suit in Maryland state court against 26 multinational oil and gas companies. They said the companies produced, marketed and sold fossil fuel products they knew to be dangerous to the climate and engaged in a “coordinated, multi-front effort” to conceal a link between fossil fuel use and climate change.

The city wants compensation for the related injuries, such as higher sea levels and the damage caused by more dramatic storms, floods, droughts and heat waves.

The companies said the case should be heard in federal court. They cited a range of reasons, but a federal district judge disagreed with all of them and remanded the case to state court.

What happened next forms the crux of the Supreme Court case. As a general rule, a district judge’s decision remanding a case to state court cannot be appealed. But there are a couple of narrow exceptions: when the suit involves federal officers or when it is about civil rights litigation.

The Richmond-based U.S. Court of Appeals for the 4th Circuit agreed that the federal district judge was right to dispose of the companies’ arguments about federal officers. It said federal law did not give it authority to rule on the other reasons.

There is a disagreement about that reading of the law in the appeals courts, and that is what the Supreme Court took the case to settle.

Justice Brett M. Kavanaugh said it was a “close call” but that a previous Supreme Court ruling by Justice Ruth Bader Ginsburg seemed to go against what the city was arguing.

“And, you know, it’s never good to be on the wrong side of Justice Ginsburg opinions, but particularly on a jurisdictional issue,” Kavanaugh said. (At the same time, he paused to say that Maryland’s court system is “very strong and has an excellent reputation.” His mother was a Maryland judge.)

There’s a chance the court could split evenly on the question. Only eight justices heard the case, because Justice Samuel A. Alito Jr. recused, most likely because of stock ownership in two of the companies.

Although none made a formal request, some environmental groups had called on Justice Amy Coney Barrett to sit out the case as well because her father was a longtime lawyer for Shell, one of the companies sued.

At her confirmation, Barrett said that as an appeals court judge, she had recused from some cases in which Shell was a party. But at the appellate level, Barrett could be replaced by another judge. That is not an option at the Supreme Court.

As has been her custom in her short time on the court, Barrett asked tough questions of both sides. But she resisted Shanmugam’s suggestion that the court decide more than the very narrow question of whether the appeals court should consider all of the companies’ arguments.

She asked: “Don’t you think it would be fairly aggressive for us” to take on more than that?

Shanmugam said the court will have to decide the broader questions eventually.