The department of mental health and addiction services may examine into, with or without expert assistance, the question of the mental and physical condition of any person committed to or involuntarily confined in any hospital for persons with mental illnesses, or restrained of liberty at any place within this state by reason of alleged mental illness and may order and compel the discharge of any such person who is not a person with a mental illness subject to court order as defined in division (B) of section 5122.01 of the Revised Code and direct what disposition shall be made of the person. The order of discharge shall be signed by the director of mental health and addiction services. Upon receipt of such order by the superintendent or other person in charge of the building in which the person named in such order is confined, such person shall forthwith be discharged or otherwise disposed of according to the terms of said order, and any further or other detention of such person is unlawful. No such order shall be made in favor of any person committed and held for trial on a criminal charge, in confinement by an order of a judge or court made in a criminal proceeding, or in any case unless notice is given to the superintendent or other person having charge of the building in which the alleged person with a mental illness is detained, and a reasonable opportunity is allowed the person in charge to justify further detention of the person confined.
R.C. § 5119.311