Lawrence Patrick, who fatally knifed 59-year-old Alexander Glassford on board a First Bus at Glasgow's Yoker Ferry Road last August, had mental health issues stretching back 20 years and had previously been violent towards his mother.
The 46-year-old, from Clydebank, faced a murder charge when he appeared at the High Court in Glasgow but his lawyers had previously entered a special defence of insanity.
At a hearing yesterday prosecutors accepted his not guilty plea to the murder on the grounds he was mentally ill at the time. Lord Burns acquitted Mr Patrick and ordered he be detained at the State Hospital without limit of time.
Concerned friends had been told he had been recently released from the State Hospital before the killing.
NHS Greater Glasgow and Clyde confirmed that Mr Patrick "was engaging with our services" at the time of the killing but gave no further details.
"As would be the case in any situation such as this an investigation is being carried out to determine if there any lessons to be learned," said a spokeswoman.
Mr Patrick had got on the M11 bus in the city's Great Western Road before Mr Glassford.
He had been heard mumbling to himself moments before the attack: "Do you want me to do it?".
After being heard talking to himself, he later approached Mr Glassford, of Knightswood, and struck him once in the neck with a knife. He could not be revived by medics.
He was detained the next day after police and negotiators arrived at his flat. Professor Lindsay Thomson, medical director at the State Hospital, said Mr Patrick had mental issues since 1993 and had been diagnosed as a paranoid schizophrenic six years later. It is recommended he is made the subject of a compulsion order and a restriction order at the State Hospital.