A woman arrested by police was carrying a Taser.
Portsmouth magistrates heard Emily Darkin bought the weapon for protection when she was homeless and would stay as the only female in a hostel.
Graham Heath, prosecuting, said the weapon was found on the 24-year-old, of Iping Avenue, Havant, when she was arrested.
He said Darkin was arrested on April 24 last year for another matter for, for which she has now been released with no further action.
He said: ‘To state the obvious the gun, I’m told, can cause pain and startle.
‘It can leave marks, possibly scars, from contact with the electrodes.’
Mr Heath said Darkin told police she bought it and kept it in a box for a number of years.
He added: ‘She referred to a third party, who she was frightened of.’
The court heard the weapon was tested by a scientist and a battery was fitted.
Darkin admitted possessing an offensive weapon on June 30.
Chairman of the magistrates’ bench Rev Raymond Burnish said imposed a 12-month conditional discharge.
He said: ‘We believe that as you have stayed out of trouble, according to your record for the last 14 months, there is an opportunity if we make this conditional discharge, you will stay out of trouble for a further 12 months.’
Mr Burnish added if she committed another offence magistrates may not deal with her as sympathetically as his bench had.
Brian McMonnies, defending, said: ‘This is not dangerous circumstances.
‘There’s no conflict, there’s no threatening of anybody with the item.
‘We don’t even know if it would have been capable of discharge.
‘But the bottom line is she shouldn’t have had it.’