The court heard that John Yelland used the name “Dr Evil” when trying to sell firearms on the so-called dark web.
His defence said that Yelland started feeling isolated and depressed after he was bullied by colleagues over his stutter.
He also saw a man killed in a rocket attack in Afghanistan and became paranoid following the murder of fusilier Lee Rigby by Islamist extremists.
Judge Anthony Bate said that Yelland had hidden the dark side of his character from his colleagues at Marham but that his messages on the dark web all had sinister undertones.
The dark web is a series of parallel search engines guarded by passwords where illegal activity thrives.