ExxonMobil prevailed Tuesday in its much-watched legal battle with the State of New York, beating back claims that it misled investors for years in how it calculated the financial risks of climate change.

The high-profile trial, which saw testimony from former ExxonMobil chief executive and former Secretary of State Rex Tillerson, marked the culmination of a more-than-three-year probe under three different New York attorneys general, during which Exxon handed over millions of documents about its internal dealings.

But that extensive effort wasn’t enough to convince New York Supreme Court Judge Barry Ostrager that the oil and natural gas giant broke state securities laws when describing to shareholders how it analyzed the effect of future greenhouse-gas regulations on the company’s bottom line.

During a 12-day trial this fall, the state tried to wield a powerful antifraud law, called the Martin Act, that does not require prosecutors to prove that a company intended to deceive investors. The office of Letitia James, New York’s current attorney general, tried to show the company lied to investors by keeping two sets of books -- one public, one private -- for estimating the cost of complying with future climate regulations.

But even with that relatively low bar, Ostrager found New York's allegations "to be without merit" and the use of the state's securities law to be a stretch in this case.

"Nothing in this opinion is intended to absolve ExxonMobil from responsibility for contributing to climate change," Ostrager wrote in his ruling. "ExxonMobil does not dispute either that its operations produce greenhouse gases or that greenhouse gases contribute to climate change. But ExxonMobil is in the business of producing energy, and this is a securities fraud case, not a climate change case."

In the harshly worded ruling, Ostrager said that the New York attorney general had not produced any investor harmed and that it failed to show “that ExxonMobil made any material misstatements or omissions about its practices and procedures that misled any reasonable investor.”

ExxonMobil saw the decision as vindication that it had been besieged by a politically motivated attack in a state controlled by Democrats.

“Today’s ruling affirms the position ExxonMobil has held throughout the New York attorney general’s baseless investigation,” Exxon spokesperson Casey Norton said. “We provided our investors with accurate information on the risks of climate change. The court agreed that the attorney general failed to make a case.”

"Lawsuits that waste millions of dollars of taxpayer money do nothing to advance meaningful actions that reduce the risks of climate change," he added.

“Round one goes to Exxon, but this is going to be a longer fight,” said Andrew Logan, director of the oil and gas program at Ceres, a nonprofit group of environmentalists and investors.

The Massachusetts attorney general, Maura Healey, in October sued ExxonMobil for “deceptive advertising to Massachusetts consumers and for misleading Massachusetts investors about the risks to Exxon’s business posed by fossil fuel-driven climate change-including systemic financial risk.”

Logan said the emphasis on consumers and misinforming the general public in the Massachusetts case would avoid the need to find harm to a "reasonable investor."

"These cases will get easier to prove unfortunately as climate change gets worse," he said. "But if you wait long enough for damage to be obvious, you miss the opportunity to prevent it in the first place."

In a statement, James’ office insisted that the case had been worth pursuing. She said that “for the first time in history, ExxonMobil was compelled to answer publicly for [its] internal decisions that misled investors.” She said that “Exxon’s inability to tell the truth further underscores the lies that have been sold to the American public for decades.”