In the largest environmental settlement in the US history, oil and gas giant BP will pay over $20b to the American government over damages caused by an rig explosion and oil spill on April 20, 2010 in the Gulf of Mexico. A US judge approved the settlement deal, resolving years of litigation over the worst offshore spill in the nation’s history.

The settlement, first announced in July, includes $5.5b  in civil Clean Water Act penalties and billions of dollars more to cover environmental damage and other claims by the five Gulf states and local governments. The money is to be paid out over roughly 16 years, according to CBS News.

The worst offshore oil disaster in the US history killed 11 workers and spewed millions of barrels of oil onto the shorelines of several states for nearly three months, wrote Fortune.

Oil from the spill was deposited onto at least 1,036 sq km of the sea bedrock and washed up onto more than 2,092 km of shoreline from Texas to Florida. The oil was toxic to fish, birds, plankton, turtles, and mammals, causing death and disease and making it difficult for animals to reproduce.

BP has estimated that its costs related to the spill, including its initial cleanup work, various settlements as well as criminal and civil penalties, will exceed $53b, according to The Tribune.