GREENVILLE, N.C. -- Duke Energy pleaded guilty Thursday to nine violations of the federal Clean Water Act and will pay $102 million in fines and restitution for illegally discharging pollution from coal-ash dumps at five North Carolina power plants.

The plea by the nation's largest electricity company, part of a negotiated settlement with federal prosecutors, is the result of an investigation that began in February after a pipe collapsed under a coal ash dump, coating 70 miles of the Dan River in gray sludge.

Duke has agreed to pay $68 million in fines and $34 million on environmental projects and land conservation that will benefit rivers and wetlands in North Carolina and Virginia.

Judge Malcolm Howard said this was the largest federal criminal fine in North Carolina history.

"The massive coal ash spill into North Carolina's Dan River last year was a crime and it was the result of repeated failures by Duke Energy's subsidiaries to exercise controls over coal ash facilities," Assistant Attorney General John C. Cruden of the Justice Department's Environment and Natural Resources Division said in a statement. "The terms of these three plea agreements will help prevent this kind of environmental disaster from reoccurring in North Carolina and throughout the United States by requiring Duke subsidiaries to follow a rigorous and independently verifiable program to ensure they comply with the law."

Duke was also sentenced to five years' probation. Under the terms, the company will be monitored for compliance. If it violates the Clean Water Act, Duke could be subject to further action of the court.

The sentencing came after prosecutors told Howard that Duke ignored repeated warnings about problems at its coal ash pits. Prosecutors said that Duke's illegal pollution had been going back to at least 2010.

The environmental violations involve pollution discharged by coal-fired power plants in Eden, Moncure, Asheville, Goldsboro and Mt. Holly.

Holding the company's plea agreement in his hand, Howard went through each charge and asked if the company had engaged in these illegal actions. Julia Janson, the company's chief legal officer, replied yes. Then the judge asked how Duke was pleading to each count. And each time, she replied softly, "Guilty."

At the hearing, prosecutors gave multiple examples where Duke employees knew or were warned that they were discharging pollution into the state's waterways and they were slow to do anything or took no action at all.

At Dan River, officials at the plant requested $20,000 from company headquarters to use a camera to inspect four pipes, including the one that eventually collapsed, and another that was found leaking after the spill.

The company denied the request on two occasions, even after a top manager at the plant called to personally ask for the money to inspect the pipes.

In another example, Duke illegally channeled seeps from its Asheville plant into the French Broad River. At the Moncure plant, employees informed supervisors in 2011 a riser pipe was leaking, but no action was taken for two years. As a result, prosecutors say Duke was engaged in unpermitted discharges. The company was negligent because it knew about the problems but failed to take action.

Duke has said in statements and court filings that the costs of the settlement will be borne by its shareholders, not passed on to its electricity customers.

Duke said it would answer questions after the sentencing. But in a statement, the $50 billion Charlotte-based company said the hearing "officially closes a chapter in the company's history."

"We've used the Dan River incident as an opportunity to set a new, industry-leading standard for the management of coal ash. We are implementing innovative and sustainable closure solutions for all of our ash basins, building on the important steps we've taken over the past year to strengthen our operations. Our highest priority is to operate our system as safely as possible for the customers and communities we serve," the release said.

Environmental groups hailed the charges as vindication for their years of efforts to get regulators to hold Duke accountable for the pollution leaking from 32 coal ash dumps at 14 power plants scattered across the state. The ash, which is the waste left behind when coal is burned to generate electricity, contains such toxic heavy metals as arsenic, selenium, chromium and mercury.

The Associated Press reported last year that environmental groups tried three times in 2013 to sue Duke under the Clean Water Act to force the company to clean up its leaky coal ash dumps. The groups said they were forced to sue after North Carolina regulators failed to act on evidence conservationists gathered of ongoing groundwater contamination at Duke's dumps.

But each time, N.C. Department of Environment and Natural Resources blocked the citizen lawsuits by intervening at the last minute to assert its own authority under the act to take enforcement action in state court.

The administration of Gov. Pat McCrory, a Republican who worked at Duke for 29 years, then proposed what environmentalists derided as a "sweetheart deal" under which Duke would have paid fines of just $99,111 to settle violations over toxic groundwater leeching from two of its plants. That agreement, which included no requirement that Duke immediately stop or clean up the pollution, was pulled amid intense criticism after the Dan River spill.

But McCrory spokesman Josh Ellis said the governor has taken strong action on the issue.

"We've taken more enforcement action on coal ash than any administration in state history, begun implementing the toughest coal ash law in the nation and issued the largest fine in state history," he said in an email.