Jospeh Ayiety left Sergeant Kevin Reynolds blood-soaked after turning on him at the 27 year-old’s flat in Maryhill on September 23 2022.
Ayiety also punched and tried to headbutt PC Kirsty McGlynn after locking both officers in the property.
Police had gone there after he had earlier assaulted a woman at a bus stop and a supermarket worker.
Ayiety had faced a string of charges at the High Court in Glasgow including the attempted murder of Sgt Reynolds.
But, he was formally acquitted after prosecutors accepted he was suffering from a mental disorder at the time and was not criminally responsible.
Ayiety will remain at the State Hospital in Carstairs for treatment after he was given a complusion order on Monday.
READ NEXT:Â Violent rapist subjected women to sex attacks in their homes
READ NEXT:Â ‘I’m gonna slash you’: Man threatened sheriff and threw crisps at him
The hearing was told he had a history of issues relating to his mental health.
He stayed alone at a flat in the city’s Maryhill. There were a number of concerns including around his living conditions.
Around a fortnight before the police attacks, Ayiety pushed and punched a woman In Glasgow’s Queen Margaret Drive after he alleged she had been looking at him.
He was charged with him due to appear in court at a later date.
But, on September 22, Ayiety went on to slap and try to kick a worker from a Tesco store he was already banned from.
This lead to Sgt Reynolds and PC McGlynn being at his home the next morning.
Prosecutor Michelle Brannagan said Ayiety – described as being of “stocky build” – was initially “calm” when they arrived.
He was spotted locking the front door, but, due to “safety concerns”, Sgt Reynolds asked for it to remain open.
Miss Brannagan said: “They explained why they were there. He was advised he would be taken to a police station, at which time he replied no while shaking his head.”
Ayiety then walked to the door and the officers reckoned he may try to flee.
PC McGlynn got hold of his wrist, but, as they stood in the narrow and dimly lit hallway, he managed to lock the front door.
The court heard Ayiety’s “demeanour” then changed.
Miss Brannagan said:Â “He suddenly turned around and punched PC McGlynn to her face.
“He then entered the kitchen and returned holding a green handled kitchen knife.”
Both officers used their incapacitant spray to try fend Ayiety off, but it had little effect.
The advocate depute said:Â “It was at this point he suddenly brought the knife down striking Sgt Reynolds to the back of his neck.
“Sgt Reynolds had no means of escape…and attempted to protect himself by covering his head with his hands.
“He continued the attack repeatedly striking him to the head and neck in a frenzied attack which caused the officer to suffer a number of injuries which were bleeding heavily.”
PC McGlynn pressed her the spray again and repeatedly used her police baton in a desperate bid to stop Ayiety.
However, he continued to struggle and attempted to headbutt her.
She was eventually able to grab his arm and apply handcuffs.
A badly wounded Sgt Reynolds also helped get Ayiety out the flat. He continued to violently resist and also tried to get rid of the blade.
Other officers soon arrived for back up. Sgt Reynolds was heard stating to them: “He just tried to murder me. He tried to kill me.”
He was treated at hospital for wounds to his arm, neck and back of the head. Sgt Reynolds has been left scarred for life.
PC McGlynn initially did not need medical help, but later needed a check after the ordeal.
It is not known how affected either officer is by what happened.