BP has received the biggest criminal fine in US history as part of a $4.5bn (£2.8bn) settlement related to the fatal 2010 Deepwater Horizon disaster.
Two BP workers have been indicted on manslaughter charges and an ex-manager charged with misleading Congress.
The Department of Justice (DoJ) said BP must hand over $4bn. The sum includes a $1.26bn fine as well as payments to wildlife and science organisations.
As part of the agreement, BP will also plead guilty to 14 criminal charges.
The company apologised for its role and said it regretted the loss of life.
BP will also pay an $525m to the Securities and Exchange Commission over a period of three years, the firm said.
The resolution with the DoJ includes a record criminal fine of $1.26bn, as well as $2.4bn to be paid to the National Fish and Wildlife Foundation and $350m to be paid to the National Academy of Sciences, over a period of five years.
DoJ Attorney General Eric Holder said its resolution "stands as a testament to the hard work of countless investigators, attorneys, support staff members, and other personnel".
He went on: "In addition to the charges filed against BP, a federal grand jury returned an indictment charging the two highest-ranking BP supervisors, who were on board the Deepwater Horizon on the day of the explosion, with 23 criminal counts - including 11 counts of seaman's manslaughter, 11 counts of involuntary manslaughter, and alleged violations of the Clean Water Act.
"The grand jury also charged a former BP executive - who served as a deputy incident commander and BP's second-highest ranking representative at Unified Command during the spill response - with hiding information from Congress and allegedly lying to law enforcement officials."
The executive, David Rainey, is alleged to have intentionally under-estimated the amount of oil spilling from the well.
The two oil well supervisors accused of manslaughter were named in the indictment as Robert Kaluza and Donald Vidrine, according to the news agency Associated Press.
They were accused of negligence in the way they oversaw safety tests on the Deepwater Horizon rig before the accident, and failing to alert onshore engineers to problems with the drilling.
As a result of the settlements, the company said that it was setting aside an additional $3.85bn on top of the $38.1bn it has been raising to cover its liabilities from the incident. The UK-based oil giant has been selling assets to raise the funds.
"All of us at BP deeply regret the tragic loss of life caused by the Deepwater Horizon accident as well as the impact of the spill on the Gulf coast region," said Bob Dudley, BP's chief executive.
"From the outset, we stepped up by responding to the spill, paying legitimate claims and funding restoration efforts in the Gulf. We apologise for our role in the accident, and as today's resolution with the US government further reflects, we have accepted responsibility for our actions."
BP added that the resolution allowed the company to vigorously defend itself against the remaining civil claims and to contest allegations of gross negligence in those cases.
BP has agreed to plead guilty to:
- eleven felony counts of Misconduct or Neglect of Ships Officers relating to the loss of 11 lives
- one misdemeanour count under the Clean Water Act
- one misdemeanour count under the Migratory Bird Treaty Act
- one felony count of obstruction of Congress
The resolution is subject to US federal court approval.
The 2010 Deepwater Horizon disaster killed 11 workers and released millions of barrels of crude into the Gulf of Mexico over 87 days.
Stuart Smith, a Louisiana lawyer representing some of the businesses affected by the accident, told the BBC the deal was far from over.
"They have not settled with the state of Louisiana for the natural damages... they haven't settled with Florida, Alabama [or] Mississippi yet."
He added that there were other significant claims still to be settled, including offshore oil and gas industry damages as a result of the moratorium on deepwater drilling put in place after the accident, casino losses, fisheries, financial institutions and real estate developers.
"So I think they're still looking at billions of dollars in exposure even with this settlement," he said.
The settlement is bigger than the largest previous corporate criminal penalty assessed by the Department of Justice, the $1.2bn fine imposed on drug maker Pfizer in 2009.
The oil giant has been selling assets worth billions of pounds to raise money to settle all claims. The company is expected to make a final payment of $860m into the $20bn Gulf of Mexico compensation fund by the end of the year.
BP launched an internal investigation in the immediate aftermath of the explosion which concluded that no single cause was behind the accident, but "multiple companies, work teams and circumstances were involved over time".
Other companies involved included Transocean, the owner of the rig and responsible for the safety valve known as the blowout preventer, and Halliburton, who provided cementing services.
BP is yet to reach a settlement with these firms. A civil trial that will determine negligence is due to begin in New Orleans in February 2013.
BP has settled all claims with Anadarko and Moex, its co-owners of the oil well, and contractor Weatherford, receiving $5.1bn cash settlements from the three firms, which it has put into its $20bn compensation fund.
It has also reached a $7.8bn settlement with the Plaintiffs' Steering Committee, a group of lawyers representing victims of the spill.