A judge on Tuesday approved New Jersey's controversial $225 million settlement with ExxonMobil Corp., following a decade of litigation over the oil giant's pollution of more than a thousand acres in the northern part of the state.

Environmental groups and Democrats in the Legislature had opposed the accord, published in April in the New Jersey Register. At trial last year, the state sought $8.9 billion in damages, and critics have since accused the Christie administration of settling for pennies on the dollar.

But Superior Court Judge Michael J. Hogan, sitting in Burlington County, wrote in his decision Tuesday that "Exxon's payment represents a reasonable compromise given the substantial litigation risks" the state "faced at trial and would face on appeal."

For the deal to be approved, Hogan wrote, it needed to be "fair, reasonable, faithful to the objectives of the Spill Act, and in the public interest." It met all those tests, he said.

Hogan earlier denied environmental groups' attempts to intervene in the case. The groups are appealing that decision, and if they succeed, they may appeal Tuesday's decision.

State officials say the agreement is the largest environmental settlement with a corporate defendant in New Jersey history.

"This is an important settlement for the citizens of New Jersey and for our environment, one which came about because this administration aggressively pushed the case to trial," acting Attorney General John J. Hoffman said in a statement.

The first $50 million of the settlement must be deposited in a fund for environmental cleanup. Another $50 million will go toward attorneys' fees, and the remaining $125 million to the state's general fund.

Of primary import was ExxonMobil's contamination of wetlands at its sites in Linden and Bayonne. ExxonMobil had agreed to remediate the sites long before trial; all that was left to determine was what, if anything, the company owed New Jersey in natural resource damages.

Through 2014, ExxonMobil spent more than $250 million remediating the two sites, Hogan wrote.

The settlement also covers contamination at 16 other sites, including one in Paulsboro, and more than 1,700 gas stations.

Hogan heard oral arguments last month.

"This is a multibillion-dollar gift to ExxonMobil from Gov. Christie and his administration, at the expense of New Jersey residents," Margaret Brown, a lawyer with the Natural Resources Defense Council, said in a statement.

She added, "This is a slap on the wrist that will do nothing to repair environmental damage the state itself called 'as obvious as it is staggering and unprecedented in New Jersey.' "

Critics of the settlement have emphasized that the state settled for far less than it sought at trial.

Hogan noted that settlement talks dated to 2007 under Gov. Jon S. Corzine. As recently as 2012, Hogan wrote, New Jersey offered to settle for $325 million, and ExxonMobil countered with a $20 million offer.

Unable to find middle ground, they headed to trial. After the trial concluded, the state informed the court that it had reached a tentative agreement with ExxonMobil.

"The February 2015 agreement was not made on a whim but was the end product of lengthy negotiations and zealous advocacy at trial," Hogan wrote, explaining how the settlement met the fairness standard.

During the 2012 settlement talks, the state established a settlement benchmark by reviewing comparable natural resource damages settlements and determining average compensation for an acre of contaminated wetlands, Hogan wrote.

"The fact that the recovery amount far outpaces the state's previous wetlands settlement recoveries shows that the amount adequately compensates the public," a key component in meeting the reasonableness standard, Hogan wrote.

Moreover, he wrote, had the state proceeded with litigation, it risked winning nothing.

The settlement also fulfilled the goals of the Spill Compensation and Control Act, Hogan wrote, which he said the Legislature passed with three main goals: "(1) assure the prompt, effective cleanup of hazardous substances; (2) place the financial burden of cleanup on polluters; and (3) encourage early settlements."