CHARLESTON, W.Va. — Federal officials have reached a settlement requiring $5 million in upgrades to prevent further pollution by Appalachian coal mines owned by West Virginia gubernatorial candidate Jim Justice.

The Environmental Protection Agency and Department of Justice announced the settlement Friday with Southern Coal Corporation and 26 affiliates. It was filed in U.S. District Court in Roanoke and still requires a judge’s approval.

The settlement resolves allegations of Clean Water Act violations from Justice-owned mines in Alabama, Kentucky, Tennessee, Virginia and West Virginia.

In its complaint, the EPA says that since it started an investigation in 2011, the agency discovered a variety of Clean Water Act violations at Southern Coal mines, including pollution beyond limits in state-issued permits for iron, total suspended solids, aluminum, pH and manganese. The agency said Southern Coal didn’t submit complete and timely discharge monitoring reports, made unauthorized discharges and wouldn’t respond to the EPA’s requests for information.

In a response statement, Southern Coal spokesman Tom Lusk said most of the violations cited were from permits inherited from coal companies not previously owned by Southern Coal.

“When Southern Coal took over some of these struggling coal operations, we knew there were violations we would have to catch up on, and we are doing it,” Lusk said.

Under the deal, Southern Coal must use an EPA-approved environmental management system, undergo internal and independent environmental compliance auditing, incorporate environmental compliance training, implement data tracking and evaluation measures, and pay escalating penalties for future violations.

The company also has to set up a public website with information about its permits, water test results and violations.

With those upgrades, the amount of pollution released into waterways by the Southern Coal mines will be reduced by about 5 million pounds a year, according to the EPA.

The company also faces a $900,000 civil penalty and must produce a $4.5 million letter of credit and trust to ensure work is completed.

“Discharging pollution from coal mining into waterways is a serious threat to clean water, and that’s why EPA stepped in on behalf of communities across Appalachia,” Cynthia Giles, EPA Office of Enforcement and Compliance Assurance assistant administrator, said in a news release. “Company-wide compliance programs like the one Southern Coal Corporation will establish are critical to protecting our lakes, rivers and streams and the people who depend on them.”

The federal government, Kentucky, Alabama, Tennessee and Virginia negotiated the settlement.

West Virginia, where Justice is running for office as a Democrat, was not a co-plaintiff in the case and will not receive a share of the $900,000 penalty, with the federal government getting $450,000 and the four other states divvying up the other half.

West Virginia helped the EPA gather evidence of Clean Water Act violations. The settlement applies to all Southern Coal operations, even where a state wasn’t a co-plaintiff, said EPA spokeswoman Julia Valentine.

In a March 2015 letter, the West Virginia Department of Environmental Protection informed the Justice Department that it was withdrawing from lawsuit discussions. The letter said the company had been submitting its reports and the most recent breach of permit limits was a self-reported manganese issue in July 2012.

DEP spokeswoman Kelley Gillenwater said the department issued three consent orders to Southern Coal’s West Virginia affiliates in 2008 with almost $1.6 million in penalties, and after that, the company’s compliance record greatly improved.

“DEP acknowledges its appreciation of the environmental management system put in place by Southern Coal and desires to afford Southern Coal opportunities to continue its improved effort to comply with environmental laws,” the DEP letter in 2015 states.