Oil company Total has been fined a record £1.125m for failings that caused one of the biggest ever gas leaks in the North Sea.
Total's Elgin platform, 150 miles east of Aberdeen, was evacuated when the gas began leaking in March 2012.
The leak was stopped after 51 days by pumping heavy mud into the well, followed by the use of cement plugs.
The Health and Safety Executive said it was the largest fine handed down by a sheriff court over health and safety.
Total admitted offshore installation regulation failings at Aberdeen Sheriff Court.
No-one was injured as a result of the leak.
The court heard that workers ran fearing for their lives after the sudden uncontrolled release of gas was discovered.
Total admitted the leak happened after miscalculating a plan designed to kill an unstable gas well on the platform.
Elisabeth Proust, managing director of Total E&P UK, said after the case: "We regret the gas leak from the Elgin platform in 2012 and accept the fine handed down by the court.
"Following the incident Total carried out its own investigation to identify the causes of the incident and what can be done to prevent similar incidents in future.
"We also cooperated fully with the investigations carried out by DECC and the HSE. Furthermore, Total has shared the lessons learned from this incident widely across the industry and with the authorities."
HSE operations manager Russell Breen said: "This incident was foreseeable and entirely preventable. There were a number of failures on the part of Total, which contributed to the blowout.
"Industry must learn from this, it is an important reminder of the ever-present hazards with oil and gas production and the need for them to be rigorously managed. This could have easily led to loss of life."
'Slap on wrist'
The RMT unions said the fine was a "slap on the wrist" and "wholly inadequate"
General secretary Mick Cash said: "For a giant global player like Total this fine can be written off as petty cash and a minor inconvenience and does nothing to hold the senior management of the company to real and genuine corporate account."
WWF Scotland director Lang Banks said: "The gas leak at the Elgin platform endangered lives, cost the company millions and added to climate change.
"It's therefore good to see a fine that reflects the seriousness of the incident.
"Hopefully the outcome of this case will send a clear message to the rest of the oil and gas industry to massively improve safety procedures.
"While it was a relief that the Elgin leak was able to be stopped, the fact it happened at all and that a potent greenhouse gas was able to spew out for nearly two months was unacceptable."
The BBC Scotland news website revealed last week that Total had been charged.