A US federal judge has told BP that contractors Transocean and Halliburton do not have to help pay compensation over the Deepwater Horizon oil spill because they are protected by their contracts.

More than 750m litres of oil spewed into the Gulf of Mexico after the undersea well blew out on 20 April 2010 and was not capped until July.

BP, Transocean and Halliburton have been sparring over who was at fault for causing the blowout. Federal investigators have said BP, the well's owner, bears ultimate responsibility for the spill but have faulted all three companies to some degree.

The ruling comes as BP, the US southern states affected by the disaster and the federal government are discussing a settlement over America's largest offshore oil spill.

The decision may have spared Transocean from having to pay potentially billions of dollars in damage claims. But the US district judge Carl Barbier said the driller was not exempt from paying punitive damages and civil penalties arising from the blowout 100 miles (160km) off the Louisiana coast. Those sanctions could still amount to billions of dollars.

BP claimed victory and said Barbier's ruling "at a minimum" left Transocean facing "punitive damages, fines and penalties flowing from its own conduct".

BP has argued it "stepped up" and admitted its role in the spill, paying billions of dollars in claims.

Transocean spokesman Lou Colasuonno countered: "This confirms that BP is responsible for all economic damages caused by the oil that leaked from its Macondo well and discredits BP's ongoing attempts to evade both its contractual and financial obligations."

Law experts were split over who is a clear-cut winner. Blaine LeCesne, an associate professor at Loyola University law school, argued it was a "major victory" for Transocean. "If anything is going to compel the parties toward settlement, it's going to be this," he said. "I think BP is in a very bad position now and they don't have a lot of leverage."

BP and Transocean had a contract that indemnified each other in the case of an accident, with BP taking responsibility for pollution originating from the well and Transocean for any pollution or accidents on board the rig. However, in court BP argued that the contract did not shield Transocean if the drilling company acted in manner that was grossly negligent.

The judge ruled that the contract was a "clear and unequivocal agreement" to provide "broad indemnity."

David Uhlmann, a University of Michigan law professor who once headed the justice department's environmental crimes section, said the ruling still left Transocean facing potentially billions of dollars in civil and criminal penalties under the Clean Water Act. "It's a partial win for each side and a partial loss for each side," Uhlmann said.

Eric Schaeffer, who led the Environmental Protection Agency's civil enforcement office from 1997 to 2002, said the ruling put even more pressure on BP. "If BP is less able to shift some of those costs to Transocean, if they understand they are going to bear Transocean's share of compensatory damages, I'd want to get it settled," Schaeffer said. "That's no longer a wildcard."

BP has been pursuing settlements that would make an upcoming trial involving hundreds of spill lawsuits in New Orleans unnecessary, or at least resolve many of the issues.

The Alabama attorney general, Luther Strange, has said the US justice department is working with the states to create an outline for a settlement that would resolve their potentially multi-billion dollar claims and the penalties and fines to be levied. In case there was a settlement, officials were discussing what to do with the $20bn fund set up by BP to pay victims.