BP has reached a deal with US prosecutors for its role in the fatal Deepwater Horizon explosion in the Gulf of Mexico that will see it pay the largest criminal fine in US history.

U.S. District Judge Sarah S. Vance agreed to accept BP's guilty plea to 11 felony counts related to workers' deaths as well as a felony related to obstruction of Congress and two related misdemeanors after a hearing Tuesday in New Orleans. BP will also pay a record $4bn fine and face five years of probation for its role in the blast and the spill the followed.

"We are deeply sorry for the tragic loss of the 11 men who died and the others who were injured that day," said Luke Keller, a Vice President of BP America in a statement to the victims' families that was read out in court and reprinted on the company's website. "Our guilty plea makes clear, BP understands and acknowledges its role in that tragedy, and we apologize - BP apologizes - to all those injured and especially to the families of the lost loved ones. BP is also sorry for the harm to the environment that resulted from the spill, and we apologize to the individuals and communities who were injured."

The fine includes $1.25bn in criminal penalties, $2.4bn owed to the National Fish and Wildlife Foundation, a $525m civil penalty to the Securities and Exchange Commission and a $350m payment to the National Academy of Science. The total sum of $4.5bn will be paid over five years, the US District Court for the Eastern District of Louisiana was told Tuesday.

The Deepwater Horizon rig exploded on 20 April 2010 as it was drilling for oil in the mile-deep Macondo well in the Gulf of Mexico. The blast killed 11 workers on the rig, which was operated by Switzerland's Transocean Ltd, and eventually led to the spillage of nearly 5 million barrels of oil into the Gulf, affecting fish, wildlife and businesses from Texas to Florida.

BP agreed to pay $7.8bn last year to cover the economic, property and pollution-related damages linked to what has been called the worst environmental disaster in US history.

A separate civil case, various State claims and alleged violations of the US Clean Water Act, which are still to be litigated, could cost the group a further $21bn.

"BP has to date spent more than $14bn in operational response and clean-up costs ... and continues to monitor the Gulf and its shoreline," the company said in its statement. "To date, BP has paid more than $9bn to individuals, businesses and government entities and has already agreed to a settlement with the Plaintiffs' Steering Committee, resolving the substantial majority of outstanding private economic loss, property damage and medical claims."

Transocean agreed on 3 January to pay $1.4bn in civil and criminal penalties for its role in the disaster after reaching an agreement with the US Department of Justice. The group said at the time it will plead guilty on 4 February to one misdemeanor violation of the Clean Water Act and accept five years' probation.

BP shares fell 0.2 percent at the open of London trading to change hands at 474.2 pence each. The shares have risen around 7.3 percent over the past year.