SAN RAFAEL (BCN) — A Marin City man pleaded guilty to second-degree murder in Marin County Superior Court Tuesday for the stabbing death of his mother, but was found to be insane at the time of the crime.

Carlos Aldana, 24, was charged with killing Rosa Aldana, 44, in her Marin City home on or around Aug. 23, 2013, the date her body was found when the Marin County Sheriff’s Office made a welfare check at her Cole Drive home.

A person who returned to the apartment before deputies arrived found the front living room covered in blood and called 911.

The California Highway Patrol then received a report about a man covered in blood boarding a Golden Gate Transit bus at Donahue Street in Marin City.

The U.S. Park Police located the bus at Fillmore and Chestnut streets in San Francisco, and Aldana threatened the officers with a knife when he got off the bus, sheriff’s Lt. Jamie Scardina said. They shot Aldana

several times, and he was taken to San Francisco General Hospital.

Aldana also was charged with animal cruelty by stabbing a pit bull in the apartment and assaulting a San Francisco peace officer. Those charges were dismissed Tuesday when Aldana pleaded guilty and was deemed to be insane.

Aldana’s sanity was an issue since the beginning of the case, and he was taken to a mental health facility in Santa Clara. He was then taken to a hospital for treatment of an infection related to his gunshot wounds.

The prosecution and defense stipulated Aldana was insane at the time of the murder, and Judge Andrew Sweet ruled he was not guilty by reason of insanity, Chief Deputy District Attorney Barry Borden said.

Aldana will spend the rest of his life in a mental health institution unless it is determined he has been restored to sanity, Borden said. Sentencing is scheduled for June 11.