(a) The director of any hospital may receive as a voluntary patient any suitable person in need of care and treatment, who voluntarily makes written application therefor. If the person is under sixteen years of age, the person may be received as a voluntary patient only on the application of the parent, legal guardian, or next-of-kin of such person, or, subject to the terms of any court order or any instrument executed pursuant to section three hundred eighty-four-a of the social services law, a social services official or authorized agency with care and custody of such person pursuant to the social services law, the director of the division for youth, acting in accordance with section five hundred nine of the executive law, or a person or entity having custody of the person pursuant to an order issued pursuant to section seven hundred fifty-six or one thousand fifty-five of the family court act. If the person is over sixteen and under eighteen years of age, the director may, in his discretion, admit such person either as a voluntary patient on his own application or on the application of the person's parent, legal guardian, next-of-kin, or, subject to the terms of any court order or any instrument executed pursuant to section three hundred eighty-four-a of the social services law, a social services official or authorized agency with care and custody of such person pursuant to the social services law, the director of the division for youth, acting in accordance with section five hundred nine of the executive law, provided that such person knowingly and voluntarily consented to such application in accordance with such section, or a person or entity having custody of the person pursuant to an order issued pursuant to section seven hundred fifty-six or one thousand fifty-five of the family court act.
(b) If such voluntary patient gives notice in writing to the director of the patient's desire to leave the hospital, the director shall promptly release the patient; provided, however, that if there are reasonable grounds for belief that the patient may be in need of involuntary care and treatment, the director may retain the patient for a period not to exceed seventy-two hours from receipt of such notice. Before the expiration of such seventy-two hour period, the director shall either release the patient or apply to the supreme court or the county court in the county where the hospital is located for an order authorizing the involuntary retention of such patient. The application and proceedings in connection therewith shall be in the manner prescribed in this article for a court authorization to retain an involuntary patient, except that notice of such application shall be served forthwith and, if a hearing be demanded, the date for hearing to be fixed by the court shall be at a time not later than three days from the date such notice has been received by the court. If it be determined by the court that the patient is mentally ill and in need of retention for involuntary care and treatment in the hospital, the court shall forthwith issue an order authorizing the retention of such patient for care and treatment in the hospital, or, if requested by the patient, his guardian, or committee, in such other non-public hospital as may be within the financial means of the patient, for a period not exceeding sixty days from the date of such order. Further application for retention of the patient for periods not exceeding six months, one year, and two year periods thereafter, respectively, may thereafter be made in accordance with the provisions of this article. In the case of a patient under eighteen years of age, such notice requesting release of the patient may be given by the patient, by the person who made application for his admission, by a person of equal or closer relationship, or by the mental hygiene legal service. If such notice be given by any other person, the director may in his discretion refuse to discharge the patient and in the event of such refusal, such other person or the mental hygiene legal service may apply to the supreme court or to a county court for the release of the patient.