Thames Water has been fined a record £20m after pumping nearly 1.5 billion litres of untreated sewage into the River Thames.
The company admitted water pollution and other offences at sewage facilities in Buckinghamshire and Oxfordshire.
Fish and birds died following the spills in 2013 and 2014.
The £20.3m fine is the largest penalty handed down to a water utility for an environmental disaster.
Judge Francis Sheridan said the scale of the problem was such that it must have been known up the chain of command.
He told Aylesbury Crown Court it was inconceivable that all the individual managers made the same decisions to run pumps at half levels, calling it a "shocking and disgraceful state of affairs".
He added: "It should not be cheaper to offend than to take appropriate precautions."
The spills occurred at four Thames Water Utilities Ltd sewage treatment works at Aylesbury, Didcot, Henley and Little Marlow, as well as a large sewage pumping system in Littlemore in Oxford.
Hundreds of fish were killed and sewage spilled into nature reserves, while nappies and other debris went into the Thames and the adjoining River Thame.
Manholes also overflowed and fewer dragon flies were reported.
Environmental damage was caused in the riverside towns of Henley and Marlow.
Company director Richard Aylard said: "We have failed in our responsibility to the environment and that hurts both personally and professionally, because we do care.
"We've also failed in our responsibility to our customers who pay us to provide an essential public service all the time, every day and not just some of the time, and we apologise for all of those failings."
Judge Sheridan said the company had a "history of non-compliance" and that managers had ignored warnings and "risks identified by employees and others".
Staff recorded a "failure waiting to happen", he said.
Robert Davis, from the Environment Agency, called it some of the worst pollution he had witnessed.
He added: "I couldn't believe what I was seeing. The river was visibly polluted bank to bank with sewage.