Enbridge Energy Partners LLP has agreed to replace close to 300 miles of one of its pipelines and pay for any remaining cleanup stemming from two oil spills in 2010, including one of the worst inland spills in U.S. history, U.S. Environmental Protection Agency officials say.

The proposed settlement, signed on July 20 by the Canadian energy giant, EPA and the U.S. Dept. of Justice, requires Enbridge to pay $177 million to resolve claims filed after spills in Marshall, Mich., and Romeoville, Ill.

In July 2010, Enbridge discharged one million gallons of tar-sands oil to Talmadge Creek, near Marshall. The spill has required 22 months of “arduous” cleanup, said acting EPA Regional Administrator Robert Kaplan. In September, another Enbridge pipeline discharged at least 6,427 barrels of oil in Romeoville. Between the two spills, Enbridge has spent in excess of $1 billion for required cleanup.

Enbridge will spend at least $110 million to prevent future spills and improve operations across nearly 2,000 miles of its pipeline system in the Great Lakes region.

Enbridge also will pay $62 million in civil penalties for Clean Water Act violations related to the spills. In addition, Enbridge will continue work—begun in 2014—on a full replacement of a 292-mile segment pipeline between Neche, N.D., and Superior, Wis., at a cost of approximately $2.6 billion. The project is in the engineering, design, environmental and permitting phases and will be placed in service in early 2019, the company says.

In a statement, Al Monaco, Enbridge’s president and CEO, said, “The learnings from our experience have made us a better company.”

But the Natural Resources Defense Council contends that the fines won’t fix the problems with heavy tar-sands crude and called the settlement a “slap on the wrist.”

After a public comment period, the settlement will need federal court approval.