A man attacked a police officer with a metal pole in the street in Bootle while claiming he was on the phone to God.
Daniel Moore, 35, swung the metal pole at the police officer several times and punched his police car after he retreated to safety.
Police were called by Moore's rattled partner, who said he had a knife and had "smashed the house up".
Natalie Cornwall, prosecuting, told Liverpool Crown Court today (August 21) that when they arrived on December 14 at about 11pm, Moore, of Grainger Avenue, Bootle, was stood in the street holding a sweatshirt and a metal pole.
Ms Cornwall said: "They tried to engage with the defendant who said he was on the phone to God."
He had drawn over himself in marker pen and there was a strong smell of cannabis, the court heard.
When police approached he waved the metal pole over his head "in an erratic manner".
Ms Hooper told officers she wanted him removed and explained he suffered from mental health problems.
As one officer approached, Moore took the pole and hit him on the right side of his neck.

The officer used an incapacitant spray - but it had little effect, and Moore struck him with the metal pole two more times as he shouted incoherently.
One of the blows hit the cop's left side and ear, leaving him deaf for weeks after.
Ms Cornwall explained the officer suffered an "immediate loss of hearing in their left ear".
Moore went to get his dog from the house, who then escaped.
After the officer retreated to the safety of his car, Moore punched the bonnet while screaming and ripped away part of the car's door.
Colleague PC Nash arrived in the street and also attempted to use an incapacitant spray but it had little effect and Moore had to be tackled to the ground.
For that incident Moore was charged with two counts of possession of an offensive weapon, assault of an emergency worker, breach of a community order and criminal damage.
Appearing on court via video link Moore was also faced with two other incidents, for which he had pleaded guilty.
Ms Cornwall, also told the court how on October 11 last year Moore broke the nose of a hospital security guard.
She said: "Paul Morris, the victim, worked as a security guard at Whiston Hospital. Between 4.30pm and 5pm Mr Morris was made aware of a man refusing to leave A&E because he had a dog."
Moore was being verbally abusive and claiming his pet was a guide dog.
The 35-year-old left but remained outside the emergency department.
Mr Morris watched Moore on CCTV as his daughter and father brought service dog stickers to put on the dog.
Moore tried his luck again in the department, barging into a triage room while a nurse was dealing with another patient.
When approached by Mr Morris he said: "You were bullied in school. Come outside and I'll f***ing t*** you."
The security guards later left to lock up but received a third call after Moore, while nurses attempted to treat him, goaded his dog to attack - although there was no response from his pet.
Mr Morris stood between the NHS workers and Moore, as he made threats and said "I'll f***ing kill you" while his dog barked loudly.
The hospital security guard put his arms around Moore but he attacked him, breaking Mr Morris' nose.
Mr Morris was due to have an operation on his nose due to the incident, but it was postponed due to the pandemic.
Ms Cornwall explained he has since suffered from pain in his nose and a change in breathing pattern.
Between December 9 and December 11 last year Moore also threatened staff at Whiston hospital while an inpatient on a mental health ward, and damaged property by writing on the walls of his room with a felt tip pen.
After he was discharged he returned to the ward with a "large dog" and became abusive, demanding to be admitted to the ward.
He threatened to break hospital worker Alan Thompson's jaw and threatened staff with a piece of wood.
After staff shut themselves in a room he kicked the door breaking glass, which shattered over Mr Thompson and colleague Karl Dyson causing injuries.
He caused a total of £1,190.11 worth of damage to the hospital, the court heard.
Liverpool Crown Court heard evidence from Dr Fouad Basa, his treating clinician and Dr Inti Qurashi, a consultant forensic psychiatrist.
The evidence was required due to conflicting opinions on whether a section 41 restriction order, which is imposed to protect the public from serious harm, was necessary.
Dr Qurashi asserted a section 41 order should be imposed based on the nature of the offences, Moore's antecedents and risk of serious harm to the public.
Dr Basa has treated Moore for the last three months since he has been a patient at the Scott Clinic in Rainhill.
The treating clinician initially said a section 41 order did not need to be imposed based on how he well he had been doing at the hospital.
He then ultimately stated that a restriction order may be imposed in this case based on the facts.
Charles Lander, defending, reminded Judge David Aubrey, QC, of the test appropriate in this case, and that it must be based on the nature of offences, the defendant's antecedents and whether there is a risk of serious harm to the public.
Judge Aubrey, said: "I'm perfectly satisfied in the written and oral evidence from both doctors that the defendant is suffering from a mental disorder, the nature or degree makes it appropriate for him to be detained for medical treatment.
"Antecedents do not assist this court in making analysis and judgment as to whether it is necessary to impose a restriction order.
"This court has had to consider and assess the nature of the offences committed on a number of different days.
Enter your postcode below to read about crime in your area
"They are threatening in nature, on occasions involving the use of a weapon and in the court's judgement the events of the 14th December 2019 are of particular relevance."
Judge Aubrey accepted based on the reports that Moore had delusional thoughts.
Based on the evidence the judge imposed a section 37 order under the mental health act with a section 41 restriction order.
The restriction order prevents Moore from being discharged, granted leave, or moved to a different hospital, without consultation from the Secretary of State for Justice.
The order will be reviewed in six months.