A federal judge in New Orleans has granted final approval to an estimated 20 billion US dollar (£14 billion) settlement over the 2010 BP oil spill in the Gulf of Mexico.

The settlement, first announced in July, includes 5.5 billion dollars (£3.85 billion) in civil Clean Water Act penalties and billions more to cover environmental damage and other claims by the five Gulf states and local governments.

The money is to be paid out over a 16-year period.

The US Justice Department has estimated that the settlement will cost the oil giant as much as 20.8 billion dollars, the largest environmental settlement in US history as well as the largest-ever civil settlement with a single entity.

US district judge Carl Barbier, who approved the settlement, had set the stage with an earlier ruling that BP had been "grossly negligent" in the offshore rig explosion that killed 11 workers and caused a 134-million-gallon spill.

In 2012, BP reached a similar settlement agreement with private lawyers for businesses and residents who claim the spill cost them money. That deal, which did not have a cap, led to a protracted court battle over subsequent payouts to businesses. A court-supervised claims administrator is still processing many of these claims.

BP has estimated its costs related to the spill, including its initial clean-up work and the various settlements and criminal and civil penalties, will exceed 53 billion dollars (£37 billion).

David Uhlmann, a University of Michigan law professor and former chief of the Justice Department's environmental crimes section, said the ruling "ends a long sad chapter in American environmental history".

"The question that remains is whether we have learned enough from this tragedy to prevent similar environmental disasters in the future," he said.