NEW ORLEANS (AP) -- A federal judge has approved Transocean's (RIG -0.69%) agreement with the Justice Department to plead guilty to a misdemeanor charge and pay $400 million in criminal penalties for its role in the 2010 Gulf of Mexico oil spill.

U.S. District Judge Jane Triche Milazzo accepted Transocean's plea and imposed the agreed-upon sentence during a hearing Thursday. The Swiss-based drilling company could have withdrawn from the deal if she had rejected it.

Transocean agreed last month to plead guilty to a misdemeanor charge of violating the Clean Water Act. The company also agreed to pay $1 billion in civil penalties. A different judge will decide whether to accept that part of the settlement.

Transocean owned the rig Deepwater Horizon, which exploded and sank over BP's (BP 0.71%) Macondo well. The accident killed 11 men.