A New York state judge on Tuesday handed Exxon Mobil a victory in the civil case brought by the state’s attorney general that argued the company had engaged in fraud through its statements about how it accounted for the costs of climate change regulation.

After some four years of investigation and millions of pages of documents produced by the company, the judge said, attorney general Letitia James and her staff “failed to establish by a preponderance of the evidence” that Exxon violated the Martin Act, New York’s powerful legal tool against shareholder fraud, in the closely watched case.

In a statement, the company said “Today’s ruling affirms the position Exxon Mobil has held throughout the New York Attorney General’s baseless investigation. We provided our investors with accurate information on the risks of climate change. ”

In a statement, Ms. James said, “For the first time in history, Exxon Mobil was compelled to answer publicly for their internal decisions that misled investors.”