RALEIGH, N.C. — Duke Energy Corp. has agreed to pay a $6 million fine for a big spill that coated the Dan River with liquefied coal ash in 2014, North Carolina’s environment agency said Friday.

The fine holds Duke Energy accountable for violations of federal water protection laws during and after the country’s third-worst spill of the residue left behind after burning coal, the state Department of Environmental Quality said in a prepared statement.

The spill coated 70 miles of the river on the North Carolina-Virginia border in more than 30,000 tons of sludge after a pipe burst at a holding pit at Duke Energy’s power plant in Eden. Coal ash can contain toxic chemicals including arsenic, chromium and lead.

State officials originally fined Duke Energy $6.6 million for the Dan River spill, but the company contested it.

“We are accountable for what happened at our retired Dan River facility. This agreement is another important step in bringing the accident and its aftermath to a close,” the company said in a statement.

Duke Energy also challenged the environmental agency’s attempt last year to impose an unprecedented $25 million fine for persistent groundwater pollution at its closed Sutton power plant in Wilmington.

The agency later reduced that fine to $7 million and agreed it would cover groundwater contamination at all 14 coal-burning Duke Energy plants in North Carolina. Environmental groups called that a sweetheart deal for the company where Republican Gov. Pat McCrory had worked for nearly three decades.

McCrory’s environmental agency said it was forced to reduce the fine because of a policy adopted under McCrory’s Democratic predecessor that favors offenders taking corrective action over paying fines.

North Carolina officials began pursuing stronger regulations and enforcement of coal ash after the Dan River spill. North Carolina legislators required the company to clean up its unlined coal ash pits by 2029. New U.S. Environmental Protection Agency rules that took effect last year are expected to force similar cleanup at coal ash pits around the country.

Follow Emery P. Dalesio at http://twitter.com/emerydalesio. His work can be found at http://bigstory.ap.org/content/emery-p-dalesio