A federal judge on Thursday dismissed New York City's lawsuit against five of the world's largest oil companies, dealing a setback to local governments that are trying to hold the fossil fuel industry accountable for climate change.

The city had sought damages, expected to run into the billions of dollars, for the costs of adapting to rising seas and worsening heat waves as the planet warms.

U.S. District Court Judge John F. Keenan, in dismissing the case, said the courts were not the right venue for such a claim.

"Climate change is a fact of life," Keenan wrote, adding that that fact was not contested by the fossil fuel companies named in the suit. But he said global warming should be solved by Congress and the president—not by the courts.

Sign up for InsideClimate News Weekly Our stories. Your inbox. Every weekend.

New York's was the third case to be dismissed out of a dozen filed by cities and counties across four states, and by the state of Rhode Island, over the past year.

All three of the dismissed cases—in San Francisco, Oakland and now New York City—were either filed in federal court or had been moved to federal court at the request of the fossil fuel industry. In each, the industry successfully argued that federal laws, primarily the Clean Air Act, take precedence over state laws. The judge in the San Francisco and Oakland cases cited similar reasons to Keenan's for his decision to dismiss.

Yet it hasn't been a legal clean sweep for the industry. Another federal judge in California decided that six cases brought under that state's nuisance law were suitable for hearing in state court, where legal scholars say the plaintiffs may have a better chance.

Seth Stein, a spokesman for New York Mayor Bill de Blasio, said the city plans to appeal Keenan's ruling. "The Mayor believes big polluters must be held accountable for their contributions to climate change and the damage it will cause New York City," he said in an email. "We intend to appeal this decision and to keep fighting for New Yorkers who will bear the brunt of climate change."

The Problem with Fossil Fuels

Keenan, who was appointed by President Ronald Reagan in 1983, had expressed skepticism of New York City's claims during an earlier hearing.

In his opinion Thursday, he questioned the city's ability to claim that fossil fuel companies had violated the state's public nuisance laws when the city itself has been a consumer of fossil fuels for decades.

In its lawsuit, the city asked for billions of dollars to help pay for adapting to climate change brought on by the burning of fossil fuels. New York has already begun planning for a series of barriers to protect parts of lower Manhattan and Staten Island from rising seas, and it has launched a program to protect residents from the impact of worsening heat waves. The costs for each initiative will run into the hundreds of millions of dollars, the city said.

"The City seeks to shift the costs of protecting the City from climate change impacts back onto the companies that have done nearly all they could to create this existential threat," the lawsuit said.

Who's Responsible?

The city argued that the five oil companies—BP, Chevron, ConocoPhillips, ExxonMobil and Royal Dutch Shell—are responsible for the effects of climate change because they produced an outsized portion of fossil fuels burned globally and because of their roles in a campaign to discredit climate science.

As part of the complaint, New York City authorities cited research showing the companies' products have contributed more than 11 percent of all the greenhouse gas pollution since the Industrial Age began.

"It is a myth that everyone is responsible for climate change and therefore that no one is responsible," the lawsuit said.

That's what the companies argued, though, citing "literally billions" of consumers of fossil fuels around the world. The energy companies also reminded the court that the U.S. has enacted environmental statutes and regulations designed to strike an appropriate—and evolving—balance between protecting the environment and ensuring the energy supply for economic and national security.

The National Association of Manufacturers, which represents energy companies and other industries and has launched a campaign to counter the climate lawsuits, issued a statement saying the ruling should encourage other local governments to withdraw their own claims.

"From the moment this baseless lawsuit was filed, manufacturers have argued that the courtroom was not the proper venue to address this global challenge," said Jay Timmons, the group's president and chief executive. "Judge Keenan made that clear in his decision today."

Shell, in lauding the ruling, acknowledged that climate change is a problem. "Judge Keenan's decision reaffirms our view that climate change is a complex societal challenge that requires sound governmental policy and is not an issue for the courts," Shell said a statement to Bloomberg.

Ken Kimmell, president of the Union of Concerned Scientists, noted that coastal residents in New York and elsewhere can expect to see sea level rise accelerate and threaten more and more property in the coming years.

"There is a grave irony here," Kimmell said in statement. "The fossil fuel company defendants claimed in court—and the judge apparently agreed—that it is entirely up to Congress and the president to address climate change. But these same defendants and their trade groups have fought successfully against even modest laws and regulations to cut the carbon pollution from burning fossil fuels that causes global warming. My grandmother would have called this 'chutzpah' and lawyers call it 'unclean hands,' but no matter what you call it, the court should not have let these companies off the hook with this defense."