A federal judge ruled Tuesday that Halliburton can avoid paying most of the pollution claims that resulted from the catastrophic 2010 Gulf of Mexico oil spill because it was shielded in a contract with well-owner BP.

Still, U.S. District Judge Carl Barbier said that Halliburton is not exempt from paying punitive damages and civil penalties that arise from the April 20, 2010, blowout off the Louisiana coast. Those penalties could amount to billions of dollars.

The judge also said Halliburton's indemnity could be voided if the company is found to have defrauded BP. He did not rule on BP's allegations that Halliburton committed fraud by declaring the cement safe to use.

Houston-based Halliburton supplied cement for the ill-fated Macondo well that blew out in the Gulf of Mexico, and federal investigators have found that the cement failed to seal to the well properly. The cement job was one of several factors that investigators said contributed to the blowout that killed 11 workers and led to the release of more than 200 million gallons of oil.

In court filings, BP has accused Halliburton of hiding information about cement tests and defrauding BP by telling the company that the cement was safe to use. Halliburton has said it did not conceal information or commit fraud.

Both sides claimed victory on Tuesday.

BP touted Barbier's ruling as a "strong signal" that Transocean and Halliburton "would be held accountable."

"These two decisions should put an end to the attempts by Transocean and Halliburton to avoid their obligations," BP said. The company added that Halliburton "at a minimum" faced paying punitive damages and civil penalties for its role in the disaster.

BP also said it "never assumed" to get Transocean and Halliburton to pay for pollution-related damages.

Beverly Blohm Stafford, a Halliburton spokeswoman, said the company agreed with the ruling "to the extent that it requires BP to honor its contractual indemnity obligations."

Barbier's ruling came in advance of a Feb. 27 non-jury maritime-law trial in New Orleans to determine who was at fault for the blowout that led to the nation's largest offshore oil spill. Transocean, BP and Halliburton have been sparring over what caused the blowout.

Last week, BP asked U.S. Magistrate Sally Shushan to exclude trial testimony by a Halliburton employee who was working on the rig before the explosion and has been identified as a possible subject of a Justice Department criminal investigation of the disaster.

Jesse Gagliano, who worked on the well's cementing job, has been interviewed by a congressional committee and testified before a government panel probing the disaster. He initially invoked his Fifth Amendment right against self-incrimination and refused to be questioned under oath for the litigation, but he recently waived that right and agreed to be questioned by civil attorneys next week.

BP suggests Gagliano's change of heart so close to the trial is designed to give Halliburton a strategic advantage. Halliburton counters that "unfounded speculation" about Gagliano's motives shouldn't preclude his testimony.