The former owners of an oil refinery in Pembroke have been fined £5m after four contractors were killed in an explosion.
Dennis Riley, Robert Broome, Andrew Jenkins and Julie Jones had been draining a chemical storage tank at the then Chevron refinery in 2011 when flammable gases inside it ignited.
A fifth worker, Andrew Phillips, suffered life-changing burns.
Chevron said it recognised it "did not live up to" its own standards.
After the hearing, Health and Safety Executive inspector Andrew Knowles said the accident was "entirely preventable".
Chevron will have to pay the fine and court costs of £1m as part of a deal it struck with Valero Energy UK, which bought the site after the disaster.
Specialist cleaning company B&A Contracts, which employed Mr Broome and Mr Jenkins, was fined £120,000 and ordered to pay costs of £40,000 after admitting health and safety breaches.
Sentencing at Swansea Crown Court, Mr Justice Lewis said no fine could "reflect the value of someone's life."
"The tragedy has had a devastating impact on the families of those who died and on Mr Phillips and his family," he said.
"Nothing this court says or does can bring back the four people who lost their lives or minimise the suffering of Andrew Phillips."
Those working for Chevron had failed to "know of or appreciate" the risk of "flammable vapour," which had been building up in the tank over the years.
The court heard that days before the explosion one Chevron worker carried out a gas test which should have alerted the refinery to the flammable atmosphere, but the results were either miscommunicated or "not understood".
"If the work had have been stopped [at this point] the explosion would not have happened. The four deaths and the injuries would not have happened," said the judge.
Experts believed the blast would have been caused by either a spark from the workers' unearthed hosepipe or by substances in the tank, which can ignite spontaneously when dry.
Mr Justice Lewis said B&A Contracts failed to follow its own health and safety protocol by using an unearthed hosepipe to drain the tank.
Both companies previously admitted health and safety offences.
Andrew Jenkins' mother Linda said "justice hadn't been done".
"They are all going home to their family," she said. "I'll never see my son again."
Chevron said it "fully accepts" responsibility and recognised it "did not live up to" its own standards. It had "implemented changes" to avoid another disaster.
"Chevron continues to remember those individuals, families and colleagues affected by the incident," it said.
B&A Contracts also accepted responsibility and said if it could "turn the clock back" it would "in a heartbeat".
A spokesman said: "Denny, Andrew, Robert were dear friends to all of us, and Andrew was also family."
Safeguards had been implemented so "this can never happen again."