A seven-year-old boy died after touching a "defective" lighting fixture in a pub garden, a court has heard.
Harvey Tyrrell, from Harold Wood, was electrocuted as he climbed a garden wall of the King Harold Pub in Romford, east London, on 11 September 2018.
He was pronounced dead in hospital about an hour later.
Colin Naylor, 73, who installed the light fitting, denies a charge of manslaughter by gross negligence at Snaresbrook Crown Court.
Mr Naylor, an experienced electrician, also denies a second charge of failing to discharge a duty under the Health and Safety at Work Act.
David Bearman, the owner of the King Harold Pub and Mr Naylor's brother-in-law, has pleaded guilty to Harvey's manslaughter.
The court heard Harvey was visiting the pub with his parents when he sat on the wall.
Prosecutor Duncan Penny QC said: "In essence, when young Harvey both touched one of the garden lights by sitting on it and took hold of some nearby metal railings it seems clear that electricity then flowed through his body, causing fatal damage."
Jurors were told that Harvey had been playing in the pub garden with his friend, who cannot be named due to his age, before the other child briefly went to get a bag of crisps.
Mr Penny said: "Harvey was sitting on one of the lamps in the garden and gripping on to the nearby railing with his hands.
Harvey was unresponsive "leaning backwards with his head hanging back, face-up" when offered a crisp by a friend, the court heard.
He then collapsed after about 30 seconds "in front of another boy with whom he was playing", Mr Penny said.
The lights featured "significant defects", including inadequate insulation to prevent water from getting inside, he added.
An investigation following the death found 12 defects at the pub that posed a risk of injury including electric shock, and 32 potentially dangerous defects.
Bearman had been warned about "numerous electrical defects" by officers from the London Borough of Havering in January 2009.
No further investigation followed. Regulations were changed in 2013, putting the onus on property owners to organise inspections.
The jury was later told that Bearman was "blown across the cellar" after touching a fuse box at the pub in the summer of 2018, leaving him with a very large purple injury on his left arm.
In an interview with the police, Mr Naylor of Rayleigh in Essex, said he was aware of the injury but that he was not aware it related to an issue with the electricity supply.
The trial continues.