A 40-year-old science television fan who exploded home-made bombs at a quarry in Corsham has been jailed.
Michael Thomas had a hobby of making explosive devices, which was partly inspired by science larks TV show Brainiacs, Bristol Crown Court heard.
But after knocking up a potentially lethal pipe bomb he left it in the shed for years, and when his ex-wife Sarah stumbled on it she called the police.
Following an evacuation of hundreds of people in Warmley last year, the bomb squad carried out a controlled explosion of the device near the scene.
Thomas, formerly of Kennmoor Close but now living in Westwood, Bridgwater, pleaded guilty to making an explosive substance.
Jailing him for six months, Judge Michael Roach told him: "I wholly accept there was no sinister purpose to your construction of that device, but the potential for it being in a shed, unguarded, available in a residential area, makes it obvious that the risk of it simply by being left there was significant. I can't ignore those risks. Everybody should know that if they are reckless enough to build these devices prison is very likely, and almost inevitable.
"I take on board you are a hard-working man with a young family, who has stayed out of trouble for ten years and has excellent references. It is a sad day for your family."
Nicholas O'Brien, prosecuting, said the pipe bomb and other bomb-making components were found by Thomas' ex-wife when she discovered a bag while clearing out the garden shed they had once shared.
Thomas moved in with her in March 2005 and started using the shed to store caving equipment and an air rifle.
They married in August 2006, but in April 2010 the relationship broke down and Thomas moved out. On August 17, 2013, his ex-wife started to clear out the shed.
Mr O'Brien said: "Having opened the bag she saw pellets, clear liquid and a copper pipe with green chord hanging out of it.
"She became concerned and called the police. The bomb squad was called, people were evacuated and they were hosted by a café at a nearby Asda superstore."
Mr O'Brien said the bomb disposal squad deployed a robot camera and informed police the item appeared to be a homemade pipe bomb.
It was then taken to Barrs Court Park and detonated. Residents were allowed back home three and a half hours after being evacuated.
When Thomas was arrested, police found 50 videos of him underground, in railway and Ministry of Defence sites, as well as a YouTube video of TV programme Mythbusters "one million match bomb", and the Anarchist Cook Book.
Thomas accepted making the device in 2006, saying he and two others would set them off in a quarry in Corsham with little effect.
He told police that on one occasion he tried to blow up a microwave oven and on other occasions put explosives down a rabbit hole, also with little effect.
He said the inspiration came from TV show Brainiacs and he had no intention to harm anyone. He also said he packed a tube with numerous match heads and experimented.
Sam Jones, defending, said his client worked as a supermarket stock controller and had a new partner and youngsters aged two and ten months old.
He told the court: "He is the sole bread winner. The reality of what he did almost eight years ago, catching up with him in these proceedings, the reality of the position he finds himself in today with the potential of immediate custody hanging over him, has had a hugely significant impact on him. That in itself is a significant punishment."
Mr Jones said his client and others had exploded devices, in remote areas, with varying degrees of success and there was no evidence of the potency of the device discovered.
Police offered Thomas a caution in the police station but it was withdrawn by the Attorney General, Mr Jones said.