A man threatened four police officers with a stun gun after his own mother reported him.
Jamie Feeney was described as making "excessive noise" at the flat they shared in Drumchapel, Glasgow on March 10 last year.
Police arrived in the early hours and heard the 35 year-old yelling: "F***ing come ahead."
Prosecutor Craig Murray told the High Court in Glasgow: "He produced a metal object shouting: 'I have got a taser, this is a taser'.
"He opened the close door and ran outside. Police withdrew back onto the road.
"He held the stun gun out in front of him waving it at the constables causing them to retreat further."
Feeney then sprinted back into the building, but was tailed by officers, who then found him in a back garden area.
Mr Murray: "One of them used an incapacitant spray. It took effect after 60 seconds.
"He dropped the stun gun and was arrested."
The weapon - described as a "self defence" device - was later found not to be working when tested.
Mr Murray: "Feeney is not a holder of a firearms certificate or have permission to possess the stun gun."
Feeney pled guilty to a charge under the Firearms Act of having weapon with intent to cause others to believe violence would be used.
Feeney took unwell in the dock towards the end of the hearing and had to receive medical treatment.
The court later resumed in his absence and judge Lord Fairley deferred sentencing until later this month.