A gunman who was shot by police after he crossed himself and raised his weapon towards them then spat at officers as they performed first aid on him, a court has heard.

Samuel Houlihan, 24, quickly drank three-quarters of a bottle of whisky as he sat in a taxi surrounded by armed officers who suspected he had carried out an armed robbery.

His terrified taxi driver had to flee from his minibus, convinced he was about to be shot by his passenger or be caught in the crossfire during the incident in Bishop Auckland, County Durham, in May, Durham Crown Court heard.

Houlihan was shot through the taxi window and was extremely lucky to only receive a flesh wound to the shoulder, the court heard.

Houlihan was due to be sentenced after admitting possessing a firearm with intent to cause fear of violence and possessing a firearm when prohibited.

But his serious mental health problems meant he must now be assessed in hospital and the hearing was adjourned.

Richard Bennett, prosecuting, said that on the morning he was shot, Houlihan had bought an air pistol after lying to the assistant that he was not banned from owning a firearm.

He was warned in the shop to keep it out of sight or he could be caught in a police firearms incident.

Houlihan was seen by people in town centre shops and a local working men’s club to be carrying the weapon, although he made no threats to anyone.

As a taxi was taking him home armed police, who had been alerted by people in Bishop Auckland, surrounded the vehicle when it stopped at temporary traffic lights.

The terrified taxi driver complied with the commands to put his hands on his head but Houlihan refused, opened his bottle of whisky and picked up his air gun.

The driver heard a click as Houlihan appeared to cock the gun – although he had not bought any ammunition – and the cabbie decided to flee to safety.

Officers had seen the driver was petrified, the court heard, but his passenger remained calm despite the number of armed police pointing their weapons at him.

Mr Bennett said: “He then picked up his whisky bottle and promptly drank three-quarters of it in front of the officers.

“The officers were concerned he was drinking in order to prepare himself for doing something serious or life-threatening.”

He was shot with a pistol round after he was seen to pull the cocking lever on his air gun and cross himself before appearing to raise the weapon towards the officers.

Had he been shot by an adjacent officer with a carbine, Houlihan was unlikely to have survived.

He was dragged out of the taxi and officers attempted to carry out first aid.

Mr Bennett said: “The defendant was bleeding heavily from his right upper arm but after being pulled out he became violent with officers attempting to administer first aid.

“At times he was apologising for his conduct but then he would lash out and spit at the officers.

“He spat directly at two officers who were attempting to give him first aid.”

Before the shooting Houlihan’s relationship had broken down and he had voluntarily admitted himself to a local hospital because he was mentally unstable.

But two days before the incident, he was released from the hospital despite a family member telling nurses he remained unwell.

Judge Christopher Prince heard victim statements from the traumatised taxi driver who said he can no longer pick up strangers, and two armed officers, named only as C2 and C4.

C2, who fired the shot, said he was upset by Houlihan’s reaction, saying: “Here I was effectively trying to save his life and he chose this moment to spit at me.”

C4 said he and his colleagues were not wearing any protection when they answered the call-out and they genuinely believed they were about to be shot.

Judge Prince said: “In due course they should be commended for having demonstrated exemplary professionalism, bravery and humanity in this difficult and dangerous situation.”

Houlihan, whose previous offences include dressing up as a PCSO, will be sentenced next year.