A man with an "Aladdin's cave of weapons" in his home shot at police through his letterbox and threatened to "blow their brains out", a court heard.
Brian Grater, 40, also said he had a bomb in his house in Columbia Close, Gloucester, during a four-hour siege in February which saw the area evacuated.
Bristol Crown Court was told that police found an illegal Taser stun gun at Grater's property.
He admitted having an imitation assault rifle and was jailed for 21 months.
The siege began when a personal alarm given to Grater by police after he was badly injured in a previous incident sounded.
When officers arrived, he began making threats and shot at them, prosecutor Ken Bell said.
"Specialist firearms officers and negotiators were called and within minutes around eight marksmen and two experienced negotiators were at the scene," he said.
"Grater made a number of threats to shoot at the officers. He told them he had a 9mm handgun and a bomb.
He added: "Grater then started firing at his front door with what the police believed to be air pellets.
"A long-barrelled weapon was fired through his letterbox directly at the officers."
Eventually officers negotiated their way into the flat and detained Grater, he said.
"They found an Aladdin's cave of weapons that included air rifles, BB guns and rifles, a Luger pistol and a range of knives. He also had a number of crossbows."
Illegal stun gun
A later search of Grater's home also uncovered an illegal Taser stun gun.
Alec Small, defending, said: "Apart from the stun gun, the guns found in Grater's flat are not illegal weapons.
"Grater is a man who needs to be punished, but he also needs support."
Judge Mark Horton ordered for the forfeiture and destruction of the stun gun, the barrelled gun and a martial arts key chain.