When city student Thomas Godwin bought a taser disguised as a mobile phone he said he did so "as a joke".
But the smile was wiped from the 26-year-old's face when the online purchase - from a legitimate website - landed him behind bars.
Canterbury Crown Court heard he had bought the dangerous gadget for £10, putting him in breach of the Firearms Act – and leaving him facing a mandatory minimum sentence of five years in prison.
The University of Kent student, of Green Dale, Canterbury, was spotted in February by door staff at the Lady Luck pub in St Peter’s Street using the taser and videoing himself.
He was later spotted outside the Cricketers pub by the same staff, who alerted the authorities and Godwin was arrested.
The court heard the taser was not lethal and required prolonged physical contact to have any effect.
Tyrone Smith QC, defending, said: “In many cases there is always a concern the defendant has an interest in weaponry.
“But this was an impulse purchase by the defendant on January 13, along with things like a digital thermometer and a notebook.
“He’s gone shopping for a variety of items online and this just caught his eye.
"It was on sale in the ‘geek’ section - a phrase which might sum his character up.
“He is harmless in many respects, and bought something which was packaged attractively online.
"He thought it was cool and bought it as a joke for £10.”
Judge Heather Norton says there were "exceptional circumstances" which allowed her not to pass the minimum five-year term, which she said would be a disproportionate sentence.
“However, this was an item which is a prohibited weapon,” she said.
“It is an item which was in full working order and one which was taken into a public place with others around.”
Godwin, whose family lives in Switzerland, was jailed for 15 months.