Five major oil companies got their wish when a federal judge ruled to dismiss the lawsuit brought by the cities of San Francisco and Oakland. The cities sued Big Oil for the damage wrought by global warming and sea level rise.

In his order to dismiss the case, Judge William Alsup, who was presiding over the lawsuit, agreed that burning fossil fuels has contributed to global warming and sea level rise. But, in his opinion, lawsuits aren’t the best solution for this planetary problem. “Nuisance suits in various United States judicial districts regarding conduct worldwide are far less likely to solve the problem and, indeed, could interfere with reaching a worldwide consensus,” he wrote.

The defendants — Chevron, ExxonMobil, ConocoPhillips, Royal Dutch Shell, and BP — argued that the claims were “ill-suited” for resolution in the courts in their motion to dismiss the case. If the courts decided that oil and gas production was a public nuisance, it would “invade the prerogatives of Congress and the executive branch,” Theodore Boutrous, the lawyer representing Chevron, said in a hearing at the end of May.

The ruling, first reported by The New York Times, is a hurdle for the cities of San Francisco and Oakland, who sued Big Oil in state court in September 2017. The lawsuit aimed to hold the fossil fuel giants financially responsible for damage caused by climate change and sea level rise. Since these companies contributed to the harm, they should help pay to fix it and shore up infrastructure for even worse damage to come, the lawsuit says: “This case is, fundamentally, about shifting the costs of abating sea level rise harm — one of global warming’s gravest harms — back onto the companies.”

“It was like pretzel logic.”

In an early win for the oil companies, Judge Alsup ruled that the case belonged in federal court. It’s a move that oil companies tried unsuccessfully with other California climate lawsuits. “State law is much more favorable for the plaintiffs than federal law is,” says Ann Carlson, a professor of environmental law at UCLA, in an email to The Verge. Having kept the San Francisco and Oakland case in federal court, the oil companies then moved to have the case thrown out completely. “It was like pretzel logic,” says Pat Parenteau, a professor of law at Vermont Law School who is informally consulting on a similar case in San Mateo.

But the oil companies’ gambit succeeded on Monday, when Alsup ruled to dismiss the case. In retrospect, it’s a ruling that Alsup hinted at during a hearing in May when he pointed to benefits the US has reaped from fossil fuels — including, he said, victory in World War II. “[C]arbon dioxide released from fossil fuels has caused (and will continue to cause) global warming,” Alsup wrote in his order granting the motion to dismiss. “But against that negative, we must weigh this positive: our industrial revolution and the development of our modern world has literally been fueled by oil and coal.”

“That’s not good news for the plaintiffs in the New York case.”

The decision shouldn’t affect other climate change lawsuits — particularly the ones that are farthest along in California, says Carlson. Those cases will be governed by state law. “Judge Alsup’s initial decision to keep the cases in federal court was, in my view, wrongly decided,” Carlson says. “That initial decision then, in turn, led him to grant the defendants’ motion to dismiss.”

But Parenteau thinks that this could be damaging to New York City’s lawsuit, filed in federal court in January. “It’s not necessarily fatal because a district court judge’s decision in California doesn’t automatically apply in New York,” he says. “But obviously, the minute you have at least one judge’s opinion out there, that’s not good news for the plaintiffs in the New York case.”

John Coté, a spokesperson for the San Francisco City Attorney’s Office, saw a silver lining in Judge Alsup’s decision: “We’re pleased that the court recognized that the science of global warming is no longer in dispute,” Coté says in a statement emailed to The Verge. He wouldn’t say what the city plans to do next — it could appeal the decision to the 9th Circuit, or re-file the case in state court. All Coté would say is that the city is reviewing Judge Alsup’s order, and will “decide on our next steps shortly,” he says. “This is obviously not the ruling we wanted, but this doesn’t mean the case is over.”