"to confine him to a mental institution until such time as he has regained his sanity or is no longer a danger to himself or society." . . . .