A drug-crazed psychotic who plunged a kitchen knife into a stranger in the street is to be locked up in a secure hospital.

Muhammed Ali was seen sharpening a similar weapon in a public library three weeks before he attacked Jurgen McDonald in Lilycroft Lane, Manningham, Bradford, on April 20 last year.

Ali, 37, has been held in custody in Leeds Prison since the stabbing.

A judge said could have killed Mr McDonald, 50, who was running errands for his mother.

Ali pleaded guilty in November to possession of a bladed article in Manningham Library, on Carlisle Road, on March 30, 2012. He admitted racially aggravated threatening behaviour when he insulted and threatened an education welfare officer.

Ali pleaded guilty to unlawfully wounding Mr McDonald and possession of an offensive weapon. He was charged with intending to cause grievous bodily harm but he was mentally ill after abusing cannabis and cocaine and the charge could not be made out.

Ali, who lived on Lilycroft Lane, was dragged out of the library by a police officer on March 30 after staff saw him sharpening an eight-inch bladed kitchen knife on the premises.

Prosecutor Camille Morland told Bradford Crown Court yesterday he was a regular visitor to the library.

On April 10, the education welfare officer saw Ali in the street after she left the library at 5.20pm. He followed her and shouted threats and abuse in front of women and children.

The victim was distressed and alarmed, the court heard.

On April 20, Ali ran at Mr McDonald and stabbed him in the lower back, lacerating his liver.

Mr McDonald was treated in hospital overnight.

Ali was arrested nearby with a knife in his rucksack.

He told the police he was a homeless schizophrenic, saying: “Sometimes I see red. Sometimes my mind just goes blank.”

After hearing from three pyschiatrists, Judge Jonathan Durham Hall QC adjourned the case until June 18 when he will make a Hospital Order under the Mental Health Act.

Ruling that Ali was “severely dangerous and a threat to life”, the judge said: “The public must be protected from very dire consequences.”