Oil giant Valero has been fined £5m and ordered to pay £1m in legal costs after four people died in an explosion at Pembroke refinery.
At the time of the explosion the refinery was owned by Chevron who will pay the £5m fine and £1m costs.
A deal was struck before ownership changed hands to Valero Energy UK Ltd shortly after the blast.
Julie Jones, Dennis Riley, Robert Broome and Andrew Jenkins all died in the blast in June 2011.
A fifth man, Andrew Phillips, survived the blast but suffered life changing injuries, after being “surrounded in flames”.
The explosion happened when flammable gases inside an oil storage tank ignited.
Families of the victims said they were shocked to hear the "list of errors" which led to the deaths of their loved ones.
The five had been draining liquid from a storage tank as part of routine maintenance, unaware it contained highly flammable gases.
At around 6:20pm on Thursday June 2 2011, the tank exploded, engulfing those nearby in flames.
Today judge Mr Justice Lewis described it as "a fireball".
The force of the blast blew off the tank's steel roof which weighed 5 tonnes.
Specialist tank cleaning company B&A contracts, who were carrying out the work, and employed Robert Broome and Andrew Jenkins, was fined £120,000 and ordered to pay £40,000 in legal costs.
An investigation by the Health and Safety Executive (HSE), found the explosion was most likely to have been caused by the ignition of a highly flammable atmosphere within the tank.
It also found there had been long standing failures within the refinery safety management systems and as a result, the risks posed were "not understood or controlled".
Speaking at Swansea Crown Court Mr Justice Lewis said "no fine can ever reflect the value of a person's life", but that it is right that the two companies be punished and sentenced according to law.
Both companies had previously pleaded guilty to two counts each of breaching health and safety laws.
In a statement B&A Contracts said if there was anything they could do to turn back the clock they would do it "in a heartbeat".