A battery egg producer has been fined for causing unnecessary suffering to more than 1,000 hens.
RSPCA inspectors found the hens living in the droppings pit at a WJ Watkins and Son Ltd farm in Upminster, Essex.
Southend Magistrates' Court heard how the birds were forced to eat maggots, egg shells and dead birds to survive.
On Wednesday, WJ Watkins admitted permitting unnecessary suffering to birds and was fined £14,500 and ordered to pay £75,000 in costs.
In a statement the firm said: "As a company WJ Watkins and Son Limited takes the welfare of birds very seriously and we have never previously had any issues of this sort.
"We deeply regret any suffering to the birds.
"No eggs from the birds in question entered the food chain or reached the consumer."
The birds were found in September 2004 after a tip-off from a member of the public.
The court heard how the hens had escaped from the battery cages above and fallen into the pit.
Inspectors also saw hens struggling to walk because excrement was encrusted around their feet.
WJ Watkins and Son also admitted failing to maintain cages and failing to inspect hens daily.
RSPCA inspector Cliff Harrison said: "None of our inspectors will forget the sight of shed after shed of dead and dying birds.
"These pits were terrible places for hens and humans alike."
Farm manager Andrew Day, 32, pleaded guilty to causing unnecessary pain to hens, failing to ensure the welfare of animals, failing to maintain cages to prevent escape and failing to inspect hens daily.
National poultry manager Dean Andrew Sykes, 39, admitted permitting unnecessary pain to hens. The case against Mr Day and Mr Sykes was adjourned until 21 March.