ExxonMobil Corp. will pay Maryland $4 million for a  25,000-gallon oil leak at a Baltimore County gas station in early 2006, the largest civil penalty ever levied by the Maryland Department of the Environment.

The agreement also requires the company to continue cleaning groundwater contamination in the Jacksonville area or face further penalties of up to $1 million per year, officials said.

“The contamination at ExxonMobil’s Jacksonville site violates the laws put in place to protect the public and our environment,” Attorney General Doug Gansler said in a statement. “This consent decree is a significant victory for the environment and for the residents of northern Baltimore County, who have had to live with this contamination for too long.”

The February 2006 spill — when officials estimated 675 gallons of fuel leaked every day for 37 days from an underwater storage tank — was the second-largest in state history. Officials said the station’s owner failed to report the leak despite obvious inventory discrepancies.

Class-action suits filed by some Jacksonville residents whose properties and wells were contaminated by a fuel additive are pending. Glen Thomas, former president of the Greater Jacksonville Association, said the state’s settlement won’t benefit those residents affected, but he welcomed the news nonetheless.

“At least it’s a public statement that Exxon had a big impact on us, and it’s going to cost them something out of pocket,” Thomas said.

ExxonMobil representatives said the company, which posted nearly $12 billion in earnings in the second quarter, closed the station and has spent more than $34 million so far in cleanup. The “vast majority” of oil has been recovered, said Beth Snyder, a company spokeswoman.

“The  company again expresses its sincere regrets for the gasoline leak that occurred in Jacksonville, Maryland,” Snyder said.

About 10,700 gallons of liquid gasoline have been recovered, according to the MDE. However, officials said the fuel is in a dissolved state that remains in groundwater.

“The size of this penalty is commensurate with the risk to critical groundwater supplies,” MDE Secretary Shari T. Wilson said in a statement. “In the case of underground storage tanks, daily inventory and immediate follow-up to variations are critical. This case demonstrates why these rules are so important.”