BP and five Gulf states announced a record $18.7 billion settlement that resolves years of legal fighting over the environmental and economic damage done by the energy giant’s oil spill in 2010.

The settlement, if accepted by a federal judge, would end a yearslong battle between BP and the U.S. government over Clean Water Act penalties after a judge ruled the company was grossly negligent in the nearly 134 million gallon spill.