A federal judge has ruled that BP was "grossly negligent" in its actions leading up to the massive 2010 Deepwater Horizon oil spill in the Gulf of Mexico.

BP could end up paying up to $18 billion in Civil penalties

The ruling on Thursday means that BP, one of the world's largest oil companies, could end up paying up to $18 billion in fines under the Clean Water Act for its role in the disaster. BP is already paying billions of dollars in criminal fines and in payouts to people harmed by the spill.

The oil spill in question began on April 20, 2010 after a well blowout and explosion on the Deepwater Horizon, an offshore drilling rig operating in the Gulf of Mexico.

The explosion itself killed 11 people. And the spill lasted for 87 days, spewing millions of barrels of oil into the Gulf as companies struggled to cap the underwater gushing well. That oil ended up fouling beaches and harming wildlife around the region:

Three companies were implicated in the accident: BP was operating the well at the time of the spill, Transocean owned the Deepwater Horizon rig, and Halliburton had done cement work on the well that blew out.

A 2011 US government investigation blamed the blowout on defective cement in the well — and primarily faulted BP for the problems, although Transocean and Halliburton also got some blame. Among other things, the report noted that BP had skimped on safety measures in order to save on costs. (Halliburton, for its part, said that it injected cement into the well on BP's orders.)

Dividing blame among BP, Transocean, and Halliburton

The latest ruling, by US District Judge Carl Barbier in New Orleans said that BP was "grossly negligent" — a high standard that can lead to much higher civil fines. The other two companies were merely found "negligent."

The ruling puts 67% of the blame on BP

More specifically, Bloomberg reports that Barbier put 67 percent of the blame on BP, 30 percent on Transocean, and 3 percent on Halliburton.

"BP's conduct was reckless," Barbier wrote. "Transocean's conduct was negligent. Halliburton's conduct was negligent."

In a statement, BP said that it "strongly disagrees" with the ruling and would appeal. "BP believes that the finding that it was grossly negligent with respect to the accident and that its activities at the Macondo well amounted to willful misconduct is not supported by the evidence at trial. The law is clear that proving gross negligence is a very high bar that was not met in this case."

BP faces billions of dollars in fines

This is only the latest in a long string of court cases and legal wrangling over the spill — all of which has been extremely costly for BP.

This is the latest in a long line of legal wrangling

In 2012, BP accepted criminal responsibility for the disaster and paid $4.5 billion in fines to the Department of Justice. That included 11 counts of manslaughter and one felony count of lying to Congress.

Now BP potentially faces additional civil fines — up to a maximum of $18 billion under the Clean Water Act. A company involved in an oil spill that is "grossly negligent" can pay up to $4,300 per barrel spilled (although a judge can lower that amount). Barbier will ultimately set the fines based on that and a determination of how many barrels of oil were spilled. (The latter is subject to some dispute: BP says 2.5 million barrels of oil were spilled, while the judge says 4.2 million.)

On top of that, BP has also settled with various plaintiffs who had been harmed by the spill — individuals, businesses, fishermen, hotels. Those costs are estimated at $9.2 billion, although it's not clear whether this latest ruling could open additional claims. (Over at the Washington Post, Steven Mufson wrote a terrific piece about the legal wrangling around these settlements.)

In all, BP has put aside $42.5 billion to pay for the spill — including $3.5 billion for any civil penalties. BP's stock slid 4 percent immediately after the news.