NEW ORLEANS (AP) – Officials in Florida, Alabama, Mississippi and Louisiana have announced an $18.7 billion settlement with BP that resolves years of litigation over the 2010 Gulf of Mexico oil spill.

Thursday’s settlement announcement comes as a federal judge was preparing to rule on how much BP owed in federal Clean Water Act penalties after well over 125 million gallons of oil spewed into the Gulf.

BP has said its spill-related costs already exceed $42 billion – even without the Clean Water Act fine. It’s also unclear how much BP will end up paying under a 2012 settlement with individuals and businesses claiming spill-related losses.

The spill resulted from the April 20, 2010, explosion of the Deepwater Horizon rig, which killed 11 workers.