CONCORD, N.H. — Citgo will pay the state of New Hampshire $16 million to settle a long-running lawsuit over groundwater contamination by the gasoline additive MTBE.

Court documents filed Friday state the Attorney General’s office will be in charge of distributing the funds to monitor and remediate contaminated wells and public drinking supplies.

Citgo has 10 days to deliver the $16 million, after which the state has five days to file a motion to dismiss its case against Citgo.

The state filed suit against 26 petroleum companies a decade ago. By the time trial began Jan. 14, Citgo and ExxonMobil were the only remaining defendants. Shell Oil Co. and Sunoco Inc. agreed to pay the state a total of $35 million about a month before the trial started.

Two days into the trial, Citgo filed a request to be removed from the case, signaling settlement talks were underway. Superior Court Judge Peter Fauver granted the request and set Feb. 15 as the deadline for an agreement to be filed with the court.

Fauver has issued a gag order to all lawyers involved in the case. Senior Assistant Attorney General Mary Maloney said she would not comment on the settlement terms.

Attorneys’ fees and costs will be deducted from the $16 million before it is distributed by the Attorney General’s Office, according to the court documents.

The state claims that the gasoline additive MTBE, methyl tertiary butyl ether, caused groundwater contamination in a state where 60 percent of the population relies on private wells for drinking water.

MTBE had been used in gasoline since the 1970s to replace lead, increase octane and reduce smog-causing emissions. While it was credited with cutting air pollution, it was found in the late 1990s to contaminate drinking water to a higher degree than non-treated gasoline when it seeps into groundwater. The state of New Hampshire banned its use in 2007, although most petroleum companies stopped using it a year earlier, when the U.S. Environmental Protection Agency stopped requiring them to use additives.

The lawsuit is the only one brought by a state to reach trial on the issue of MTBE groundwater contamination.

Other lawsuits have been brought by municipalities, water districts or individual well owners, and most filed in the past decade have ended in settlements. New York City in 2009 won a $105 million federal jury verdict against ExxonMobil for MTBE contamination of city wells; that verdict has been appealed.

Chief Clerk Bill McGraw said before the trial began that court officials had to improvise a special docketing system because of the sheer number of participants and documents involved. More than 50,000 exhibits have been marked for identification, and there are upward of 100 lawyers on record in the case. The witness list numbers 230.

McGraw said the only other case that comes close to it in complexity is a school funding challenge of the 1990s, “and that pales in comparison to this.”

The marathon trial continues with ExxonMobil as the sole defendant. The state anticipates wrapping up its case next week, and the trial is expected to stretch into April.

Send questions/comments to the editors.