Shell and ExxonMobil have been served with final warning letters after residents complained of unplanned "flaring" at a gas plant in Fife.
Maintenance failures caused several days of flaring at the Mossmorran plant in June last year, with clouds of black smoke blowing over nearby homes.
The Scottish Environmental Protection Agency (Sepa) said residents suffered "considerable disturbance" from the noise, smoke and vibration caused by the flaring.
As well as issuing the petrochemical giants with final warning letters, Sepa will conduct a review of the environmental permits to operate sites at Mossmorran.
ExxonMobil issued an apology for the issue in June last year, though the NHS later warned the smoke was causing health problems for those living nearby.
Sepa's chief executive, Terry A'Hearn, met senior ExxonMobil and Shell executives directly on site and said that "environmental compliance is non-negotiable."
Mr A'Hearn said: "Every day, SEPA works to protect and enhance Scotland's environment and compliance with Scotland's environmental rules is simply non-negotiable.
"The impact of unplanned flaring from Mossmorran last year was both preventable and unacceptable.
"We're disappointed that both ExxonMobil Chemical and Shell UK caused an environmental impact on local communities which is why we've issued formal final warning letters, have commissioned a full review of environmental permits to operate and an enhanced programme of air quality monitoring.
"It's clear that further actions are required by ExxonMobil Chemical and Shell UK to ensure the frequency and impact of flaring is reduced, but we're encouraged by how both companies have responded, committing to respond positively to a strengthening of environmental controls."
Sepa received a total of 74 complaints over the Mossmorran plant during the summer of 2017.
An ExxonMobil spokesman said: "We apologise to the local community for the flaring in June last year which we recognise caused particular concern and inconvenience.
"We have cooperated fully with Sepa throughout its investigation and accept its findings. We have worked thoroughly to address the issues identified, consistent with our internal investigation."
ExxonMobil had since improved its maintenance process and would improve its communications with local residents, he said.
The spokesman continued: "Flaring is safe and is used widely in petrochemical plants and refineries worldwide. Flares are designed to process hydrocarbons safely when production is interrupted.
"While the flare is a vital safety system for the plant, it is otherwise of no benefit to anyone including our operations because it impacts on production."