The U.S. and the five Gulf states have finalized a settlement with BP to resolve civil claims related to the April 2010 Deepwater Horizon oil spill.

The agreement announced by the U.S. Department of Justice on Monday is the largest settlement with a single entity in the department’s history.

BP has agreed to pay a higher than expected $20.8 billion to settle the governments’ civil claims under the Clean Water Act and natural resources damage claims under the Oil Pollution Act, as well as economic damage claims of the five Gulf states and local governments.

The total is higher than the $18.7 billion deal announced in July, which officials attributed to refinements of penalties and amounts that BP has already paid, the Financial Times reported.

“BP is receiving the punishment it deserves, while also providing critical compensation for the injuries it caused to the environment and the economy of the Gulf region,” said Attorney General Loretta Lynch in the article.

As part of the deal BP will pay a record $5.5 billion for Clean Water Act violations, 80 percent of which will go to restoration efforts in the Gulf region.

Another $8.1 billion will be used to help restore damaged natural resources. This will fund Gulf restoration projects supporting habitats such as coastal wetlands, as well as marine mammals, fish and water column invertebrates, sturgeon, submerged aquatic vegetation, oysters, sea turtles and birds.

BP has also agreed to pay $4.9 billion to the five Gulf states — Alabama, Florida, Louisiana, Mississippi and Texas — and up to $1 billion to several hundred local governmental bodies to settle claims for economic damages they have suffered as a result of the spill.