BP PLC has agreed to pay $20 billion in fines—the largest in U.S. history—for the Deepwater Horizon disaster spill and cleanup of 3.1 million barrels of oil that spilled into the Gulf of Mexico and onto the shores of coastal states, the U.S. Justice Department announced Monday.

The agreement, detailed by Attorney General Loretta Lynch at a press conference and in a consent decree filed in a New Orleans federal court, includes $5.5 billion to be paid for civil claims under the Clean Water Act, $7.1 billion in natural resources damages under the Oil Pollution Act, $4.9 billion to the five Gulf Coast states, and up to $1 billion to local governments.