Beautiful story - I can't tell you what happens over there... but I can tell you what happens over here in the UK. He'd be tried for theft but sent to a hospital for evaluation, a judge would likely decide he was unfit to plead and place him on a hospital order. He would then go to hospital instead of prison on a mental health section and be given medication, once he was well - he would be found a place to live, go to a hostel and be monitored in the community by a forensics team who would keep him well. If he became unwell, he'd be immediately recalled to hospital.
That's my long-winded way of saying. If you were here, in the UK then your choice would've been the correct one. I hope the US has a similar system - and this presentation sounds like untreated psychosis likely compounded by homelessness, something that's far too common here in the UK, and I imagine even more prevalent on the West Coast of America.