Judicial review shall be in the superior court for the county in which the facility providing intensive treatment is located or in the county in which the 72-hour evaluation was conducted if the patient or a person acting in his or her behalf informs the professional staff of the evaluation facility (in writing) that judicial review will be sought. No patient shall be transferred from the county providing evaluation services to a different county for intensive treatment if the staff of the evaluation facility has been informed in writing that a judicial review will be sought, until the completion of the judicial review. The person requesting to be released shall be informed of his or her right to counsel by the member of the treatment staff and by the court; and, if he or she so elects, the court shall immediately appoint the public defender or other attorney to assist him or her in preparation of a petition for the writ of habeas corpus and, if he or she so elects, to represent him or her in the proceedings. The person shall pay the costs of the legal service if he or she is able.
Reasonable attempts shall be made by the mental health facility to notify family members or any other person designated by the patient, of the time and place of the judicial review, unless the patient requests that this information not be provided. The patient shall be advised by the facility that is treating the patient that he or she has the right to request that this information not be provided.
The court shall either release the person or order an evidentiary hearing to be held within two judicial days after the petition is filed. If the court finds, (a) that the person requesting release is not, as a result of mental disorder or impairment by chronic alcoholism, a danger to others, or to himself or herself, or gravely disabled, (b) that he or she had not been advised of, or had accepted, voluntary treatment, or (c) that the facility providing intensive treatment is not equipped and staffed to provide treatment, or is not designated by the county to provide intensive treatment he or she shall be released immediately.
Ca. Welf. and Inst. Code § 5276