Under the agreement reached by BP and five US states along the Gulf of Mexico, the British oil major will pay out $18.7 billion over 18 years. The deal resolves the firm of remaining liabilities from the biggest oil spill in US history.

A record $5.5 billion will cover federal penalties under the Clean Water Act. Louisiana, Mississippi, Alabama, Florida and Texas will receive payouts for harm done in the oil spill.

#BP to settle federal, state & local Deepwater Horizon claims. Read the full story here: http://t.co/p3PwUx8XEapic.twitter.com/U7Otzb7s5j — BP Press (@BP_Press) July 2, 2015

“Five years ago we committed to restore the Gulf economy and environment and we have worked ever since to deliver on that promise. We have made significant progress, and with this agreement we provide a path to closure for BP and the Gulf. It resolves the company’s largest remaining legal exposures, provides clarity on costs and creates certainty of payment for all parties involved,” BP Chairman Carl-Henric Svanberg, said in a statement published Thursday.

READ MORE: Private US oil company to drill near Deepwater Horizon

The agreement is of great importance to both sides, said BP Group Chief Executive Bob Dudley.

“For the United States and the Gulf in particular, this agreement will deliver a significant income stream over many years for further restoration of natural resources and for losses related to the spill,” he said. As for BP, it would help the company resolve the liabilities remaining from the catastrophe, he added. BP is now able “to focus on safely delivering the energy the world needs,” according to Dudley.

On 20 April 2010 an explosion and fire on the BP-licensed Transocean drilling rig Deepwater Horizon killed 11 workers, and left 17 more gravely injured. About 4.1 million barrels of oil spewed into the gulf. It was later determined that the mechanism intended to prevent the release of crude oil failed, which was the main reason for the catastrophe.

READ MORE: A drop in the ocean: Recovery projects worth $134 million proposed for BP oil spill

The ecological damage from the disaster was tremendous. A report from National Wildlife Federation showed that more than 8,000 birds, sea turtles, and marine mammals were found injured or dead in the six months after the spill.

“The long-term damage caused by the oil and the nearly two million gallons of chemical dispersants used on the spill may not be known for years,” the report added.