A dramatic struggle between three gardai and a notorious gangland criminal armed with a machine gun ended up in a bathtub after the gun went off - while a primed grenade lay on the floor, a court heard.
An unarmed garda "narrowly avoided being shot in the head" during the arrest, the Special Criminal Court also heard.
The three-judge court heard the evidence during the sentencing of Derek 'Bottler' Devoy (37), from Balbutcher Lane, Poppintree, Ballymun, who had pleaded guilty to possessing a Makarov sub-machine gun with intent to endanger life or cause serious injury at Crannogue Road, Ballymun, Dublin 11, on March 11, 2019.
Devoy also pleaded guilty to two charges under Section 19 of the Public Order Act for assaulting a garda and a garda sergeant at Crannogue Road on the same date.
Devoy has also pleaded guilty to possessing an explosive substance, to wit a Yugoslavian M75 hand grenade, with intent to endanger life or cause serious injury to property on the same occasion, and 11 rounds of 9mm ammunition.
The court also heard that Devoy had been given four Garda Information Messages about threats to his life.
Detective Sergeant Stephen O'Keeffe told prosecuting barrister Mr Michael Bowman SC that at around 4.35pm on the day three gardai chased Devoy from Doon Court, where he was observed by a member of the public letting off two rounds from the Makarov sub-machine gun.
The court heard that Sergeant Andrew O'Connor, Garda Niall Minnock and Garda Conor Garland were on patrol in the area at the time but were on a refreshment break and had no batons, handcuffs, personal protection equipment or pepper spray.
However, they answered a 999 call from a member of the public about Devoy being in Doon Court with the gun.
The unarmed plain-clothes gardai arrived at Doon Court and saw Devoy with the machine gun, identified themselves as gardai and gave chase when he fled, said Mr Bowman.
The chase ended up in the rear bathroom extension of a separate family's house on Crannogue Road when gardai found Devoy sitting on the toilet with the gun.
When gardai discovered Devoy, the machine gun was pointed in the direction of Sgt O'Connor and Gda Garland, who directed he drop the firearm. Devoy then lowered the muzzle towards the ground, said Mr Bowman.
Det Sgt O'Keefe said gardai jumped on Devoy "in a split second", that the firearm was discharged but all gardai and Devoy ended up in the bathtub before he could be restrained.
Gda Minnock narrowly avoided being shot in the head as the gun went off with the bullet passing his eye-line in the hallway of the extension, said Mr Bowman.
Det Sgt O'Keeffe said Gda Minnock was "very lucky, not to be two steps forward - he believed he had been shot but it was a shell casing that had struck him".
Gda Minnock kicked the firearm away and other garda units arrived at the scene.
After restraining Devoy, all three gardai observed a grenade on the ground with the pin out and the fly-off lever not attached.
The grenade, which did not go off, was later detonated in a controlled explosion by army experts at the scene, said Mr Bowman, who added it left the address uninhabitable for a number of months.
Det Sgt O'Keefe said that the grenade had a detonation time of four or six seconds with a kill radius of approximately 19 metres and had a serious-injury radius of 30 metres.
Devoy was arrested and taken to Ballymun Garda Station where he behaved violently and his clothes had to be cut from him, said Det Sgt O'Keeffe.
Devoy was transferred to hospital for treatment for a perforated ulcer for four days before he was discharged, said Mr Bowman.
Counsel said that Devoy took possession of the firearm and grenade as he knew their location from another party "in case he ever needed to use it".
CCTV showing Devoy with both the firearm and the grenade in Doon Court and being chased was also shown to the court.
In all, five casings were recovered from the bathroom along with two from Doon Court with 11 remaining in the machine gun.
Det Sgt O'Keeffe said that Devoy had 27 previous convictions, including two firearms convictions, one for which he received 10 years' imprisonment.
He has been suspected of being in the middle of a number of dangerous feuds and lost his sister and friend in a 2017 double murder.
Det Sgt O'Keeffe read Sgt O'Connor's victim impact statement to the court: "The incident had a significant effect on my life. The vision of Derek Devoy sitting with the machine gun will remain with me forever.
"I will never forget the image of the hand grenade on the floor, which if detonated would have had catastrophic consequences for all the families involved. I felt I had to be strong for my family and colleagues."
Defending barrister Mr Sean Gillane SC told presiding judge Mr Justice Tony Hunt that his client "was one of four children but is the last survivor".
The judge was told that the maximum sentence for possession of the grenade or the machine gun with intent to endanger life was life imprisonment. He adjourned the case to July 23 for the finalisation of the sentence.