A caveat has to be added, a court order for institutionalization due to mental disorder is not a "get-out-of-jail" card. In many cases, there is no pre-determined "end-date" to being locked away in a mental hospital, unlike most sentences (even life sentences for murder in HK in most cases is not a true life sentence, as they will be released after several decades). So if the psychiatrist deem the patient still a risk to society after periodic reviews, they can be locked away for life, literally.