(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.