Crews on ships work on stopping the flow of oil

British energy giant BP on Thursday announced it had agreed to settle US federal and state claims worth up to $18.7 billion (16.9 billion euros) over the 2010 Gulf of Mexico oil spill.

"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," said BP chairman Carl-Henric Svanberg in a statement.

The head of the US Justice Department, Attorney General Loretta Lynch, hailed the record settlement.

"If approved by the court, this settlement would be the largest settlement with a single entity in American history; it would help repair the damage done to the Gulf economy, fisheries, wetlands and wildlife; and it would bring lasting benefits to the Gulf region for generations to come," Lynch said in a statement.