A federal judge in New Orleans has granted final approval to an estimated $20bn settlement, resolving years of litigation over the 2010 BP oil spill in the Gulf of Mexico.

US district judge Carl Barbier’s final order on the settlement was released on Monday.

The settlement, first announced in July, includes $5.5bn in civil Clean Water Act penalties and billions more to cover environmental damage and other claims by the five Gulf states and local governments. It is the largest environmental settlement in American history. The money is to be paid out over a 16-year period.

Barbier had set the stage for the settlement with an earlier ruling that BP had been “grossly negligent” in the offshore rig explosion that killed 11 workers and caused a 134m-gallon spill.

At the time, BP’s chief executive, Bob Dudley, called the settlement a “landmark step forward for all parties” despite the fact that the oil company suffered a $6.3bn quarterly loss when the settlement was announced.

“The numbers are huge but we can now plan for the future. That is a state we haven’t been in for five years,” Dudley said in July.

“This historic resolution is a strong and fitting response to the worst environmental disaster in American history,” the US attorney general, Loretta Lynch, said in October 2015. “BP is receiving the punishment it deserves, while also providing critical compensation for the injuries it caused to the environment and the economy of the Gulf region.”

In the months since the original settlement was announced, BP has reported an annual loss of $6.5bn – the worst in its history. The company also announced that it was cutting 7,000 jobs. Dudley, on the other hand, earned nearly $20m last year, receiving a 20% hike despite record losses.

Since the settlement had already been announced back in 2015, BP shares were little affected by Monday’s news.

This might not be the end of legal troubles for BP, however. The company is facing yet another lawsuit related to spill – this time in Mexico.

The case was brought by Sinaloa Class Actions – an organization composed of lawyers specializing in environmental disasters – in December. According to the lawsuit, within days of the rig explosion oil reached shores of Mexico, affecting hundreds of communities which rely on fishing and tourism for revenue.

“BP has accepted it is responsible and is paying for the damage in the US. The damage is ongoing here,” Luis Manuel Pérez de Acha, a lawyer bringing the case, told the Guardian at that time.

The Associated Press contributed to this report.

