(Reuters) - In the last month, the cities of New York and Oakland, both represented by the able lawyers at Hagens Berman Sobol Shapiro, failed to persuade federal judges to allow them to proceed with nuisance claims blaming major oil companies for selling fossil fuel in the face of overwhelming evidence that oil and gas emissions are responsible for climate change. U.S. District Judge William Alsup of San Francisco dismissed Oakland’s case on June 25. Manhattan federal judge John Keenan tossed New York’s suit on Thursday.

Both judges lamented the climate change crisis and acknowledged the science linking it to fossil fuel emissions. There’s no doubt, Alsup and Keenan said, that global warming is real, and that is affecting the entire planet.

But that doesn’t mean the problem can be solved in piecemeal litigation, both judges said. Here’s Judge Keenan in the New York case: “The immense and complicated problem of global warming requires a comprehensive solution that weighs the global benefits of fossil fuel use with the gravity of the impending harms. To litigate such an action for injuries from foreign greenhouse gas emissions in federal court would severely infringe upon the foreign-policy decisions that are squarely within the purview of the political branches of the U.S. Government. Accordingly, the court will exercise appropriate caution and decline to recognize such a cause of action.”

And here’s Judge Alsup in last month’s Oakland ruling: “This order fully accepts the vast scientific consensus that the combustion of fossil fuels has materially increased atmospheric carbon dioxide levels, which in turn has increased the median temperature of the planet and accelerated sea level rise. But questions of how to appropriately balance these worldwide negatives against the worldwide positives of the energy itself, and of how to allocate the pluses and minuses among the nations of the world, demand the expertise of our environmental agencies, our diplomats, our Executive, and at least the Senate. 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.”

To be clear, these two rulings are hardly the end of state and local climate change suits asserting nuisance claims against big oil companies. Baltimore just announced a suit Friday in Maryland state court – the 13th local government, according to the Sierra Club, to sue oil companies for selling fossil fuels despite knowledge of the consequences. Rhode Island has sued as a state in Rhode Island state court. Oil company defendants routinely remove cases to federal court, but that’s no guarantee the suits will stay there. Last March, for instance, U.S. District Judge Vince Chhabria of San Francisco granted a motion by San Mateo County to remand its case to state court.

But the Alsup and Keenan decisions, in tandem, show how hard it will be for local governments to win climate change suits in federal court, even if their claims are based on state public nuisance laws. I’ve been writing about litigation for long enough to have seen the concept of regulation-by-litigation wax and wane, from state attorneys general beating the tobacco industry into compliance to gun companies receiving blanket Congressional immunity in the face of a plaintiffs’ lawyer onslaught.

Both judges determined that federal common law governs the cities’ claims because pollution is an interstate issue. New York tried to argue that its case isn’t governed by federal law because its claims are based on the sale of fossil fuels, not the fuel emissions. Judge Keenan said the framing didn’t make a difference. “The city’s claims are ultimately based on the ‘transboundary’ emission of greenhouse gases, indicating that these claims arise under federal common law and require a uniform standard of decision,” he wrote.

The U.S. Supreme Court has expressly held, in 2011’s American Electric Power Company v. Connecticut, the Clean Air Act displaces federal common law claims based on fossil fuel emissions. (In that case, eight states, New York City and private land trusts sought emissions restrictions from major oil companies.) The 9th U.S. Circuit Court of Appeals, in 2012’s Kivalina v. ExxonMobil , extended that holding to apply to damages claims based on past emissions.

Judge Keenan found that AEP and Kivalina spelled the end of New York’s nuisance and trespass claims, despite the city’s attempt to pin liability on sales, rather than emissions: “Under AEP and Kivalina, the Clean Air Act displaces the City’s claims seeking damages for past and future domestic greenhouse gas emissions brought under federal common law,” he wrote. Keenan added that the Supreme Court’s AEP ruling may have kept alive the possibility that state law claims are not pre-empted, but that New York City’s suit was based on global emissions from the worldwide sale of fossil fuels – not just on oil production in New York – so the AEP’s state-law exception doesn’t apply.

Judge Alsup agreed, to the extent Oakand’s suit claimed damages related to emissions in the U.S., regardless of the city’s sales-not-emissions theory. “If an oil producer cannot be sued under the federal common law for their own emissions, a fortiori they cannot be sued for someone else’s.”

New York City and Oakland seem to have anticipated that the Clean Air Act would displace their claims based on emissions within the U.S. Both suits also alleged oil companies engage in global oil sales so they’re liable for international emissions.

But there, too, the federal judges said the suits fell short. The Supreme Court has acknowledged that private plaintiffs can bring federal tort claims, both Keenan and Alsup wrote, but its most recent decisions have urged federal courts to be extremely leery of overextending the reach of U.S. laws and intruding in matters that implicate foreign policy concerns. International regulation of fossil fuel sales and emissions, the judges said, is precisely the sort of thing the Supreme Court had in mind.

As I said, cities and states may yet succeed against oil companies in state court, or may find ways to recraft theories to evade the conclusions Judges Keenan and Alsup reached. But it’s not going to be easy.