The Central Criminal Court has heard that two gardaí believed they were going to be killed, when a man started shooting at them from a bedroom window after they responded to reports of gunshots.

Daniel Goulding, 39, of Whitechapel Grove, Clonsilla, Dublin, pleaded guilty to the attempted murder of the gardaí outside his home on 25 May 2021 and will be sentenced later in the week.

Both gardaí were shot in the left foot and one was also shot in the right hand.

One of the gardaí told the court that he came extremely close to being the 90th member of An Garda Síochána to be killed on duty and this caused him distress.

In a victim impact statement read to the court, the other garda said he had been diagnosed with Post Traumatic Stress Disorder and could not see himself ever being able to return to frontline duties.

Detective Sergeant Michael Redmond told the court the two gardaí were the first on the scene when reports of gunshots at the address at Clonsilla were received at around 7pm on 25 May 2021.

Neighbours also reported seeing Goulding sitting topless at a window at the top of the house, shouting and acting erratically.

The gardaí arrived in an unmarked car with blue lights flashing. As they left the car intending to begin talking to neighbours, Goulding began firing out the window at them. The gardaí ducked behind the car as the shots continued. Both men received gunshot wounds and remained hiding behind the car until their colleagues were able to evacuate them from the scene.

A garda who knew Goulding well, managed to intervene and the incident eventually ended after around two hours when he gave up his weapons and surrendered to the gardaí at the scene. Gardaí took possession of three guns including a pistol and a sub machine gun.

Sergeant Redmond told prosecuting counsel, Sean Gillane, that eight shots were fired at the gardaí and the shooting lasted a total of three and a half minutes.

Goulding has 33 previous convictions including a ten-year prison sentence for possession of drugs for sale or supply. He spent a considerable period of that sentence in the Central Mental Hospital and was diagnosed with paranoid schizophrenia.

There had been a number of threats to Goulding's life and gardaí had called to his home the evening before the shooting to check on him in relation to the most recent threat.

In his interviews with gardaí afterwards, Goulding said he could not remember a lot of what had happened. He said he thought it was "a hit" on him, when the car with the gardaí pulled up outside his house. He said he had no idea they were detectives and that his head "was in a rumble".

Sergeant Redmond agreed with defence counsel, Michael Bowman, that from 2018 Goulding rarely left his house except to attend psychiatric appointments. The court heard a psychiatric report showed he was in the grips of a psychotic incident at the time of the shooting.

In a victim impact statement read to the court, the first garda said he had been left with limited movement in his hand and permanent damage to his hearing. He suffered from PTSD and was in a constant state of anxiety.

He said Goulding opened fire on them for no reason and he would never forget the disbelief he felt at the time or hearing his colleague who had also been shot, in pain. He said as he hid behind the car, he was afraid Goulding would come out of his house and "finish them off" and he would be another name on the list of gardaí, killed on duty, at the front of the garda college.

The second garda said the call to Goulding’s home was the first call he responded to that day, and it was nearly his last. He said he came extremely close to not coming home. He had never come so close to death, he said, and had never experienced fear like that before.

He said not a day went by when he didn’t think of the incident and the scar on his foot was a constant reminder. He has returned to work but he said certain career opportunities had been lost to him and this was frustrating. Both men thanked their colleagues for bringing them to safety.

Mr Bowman said this was an incident of the utmost gravity and seriousness and a terrifying ordeal for the two gardaí.

But he asked the court to take into account that this was not a premeditated incident and said Goulding was suffering from an ongoing, deep-seated and well-fixed psychiatric difficulty with the background of real threats to his life.

Mr Justice Paul McDermott said he would sentence Goulding on Friday.