BP oil spill settlement
Workers clean up from the Deepwater Horizon oil spill in the Gulf of Mexico, in Waveland, Mississippi, July 9, 2010. On Monday, a federal judge finalized years of litigation against British oil giant BP. But the most of the $20.8 billion the company will pay out over the next 16 years is tax-deductible. Joe Raedle/Getty Images

A federal judge in New Orleans closed the books on years of litigation from the 2010 BP oil spill in the Gulf of Mexico. But environmentalists and lawmakers are livid that the deal allows the British oil giant to write off most of the $20.8 billion as just another cost of doing business.

U.S. District Judge Carl Barbier finalized on Monday a settlement first announced last summer. It requires BP to pay a federal $5.5 billion non-tax-deductible civil penalty under the Clean Water Act and the rest to five Gulf states and local government. The money will be paid out over 16 years, or an average of $1.3 billion a year.

But lawmakers and environmentalists had been pushing to ensure strong language that would make clear that the $15.3 billion going to state and local governments be treated the same way as the federal penalty.

A letter signed by 53 House members sent to Attorney General Loretta Lynch in November demanded federal prosecutors prohibit BP from treating the money to the states as a tax write-off.

“We are concerned that without strict language to the contrary, BP will seek to claim the remaining $15.3 billion as a business expense, displacing the burden of that uncollected revenue onto every other taxpayer while securing a tax windfall worth $5.35 billion for itself,” said the letter signed by Natural Resources Committee Ranking Member Raul Grijalva (D-Ariz.).

From an accounting perspective, BP will be allowed to book the damages it pays to the states as a basic operating expense, just like money it spends on stuff like building new oil storage facilities, or maintaining oil rigs. Most of the money for the “grossly negligent” behavior will be viewed by the U.S. government as nontaxable.

The U.S. tax code allows companies to deduct punitive damages and write them off as losses, but the law also permits specific wording in settlements to force companies to pay taxes on the income used to pay the penalties. BP earned adjusted annual profits of between $13 billion and $21 billion a year between 2009 and 2014, according to Thomson Reuters.

“We are saddened to learn that the gross negligence of BP continues to enjoy taxpayer subsidies,” Lukas Ross, head of climate and energy at the Washington, D.C.-based Friends of the Earth environmental nonprofit group, said in a statement Monday. “It is clear that we have still failed to learn all the lessons of the Deepwater Horizon.”