—In a habeas corpus proceeding, the petitioner, a patient at Kings-borough Psychiatric Center, (1) appeals from an order of the Supreme Court, Kings County (Duberstein, J.), dated March 29,1996, which dismissed the writ as academic, and (2) purportedly appeals from an oral decision of the same court made on March 21, 1996, which determined his motion for sanctions against the respondent pursuant to 22 NYCRR 130-1.1.
Ordered that the purported appeal from the decision is dismissed, without costs or disbursements, as no appeal lies from a decision (see, Schicchi v Green Constr. Corp., 100 AD2d 509); and it is further,
Ordered that the order is reversed, on the law, without costs or disbursements, the writ is reinstated and sustained to the extent that the respondent shall discharge the petitioner unless the Supreme Court, Kings County, commences a hearing within 15 days of the date of this Court’s decision and order to determine whether the petitioner is mentally disabled or in need of further retention for in-patient care and treatment pursuant to Mental Hygiene Law § 33.15 (b), and the Supreme Court shall continue the hearing on successive court days without substantial interruption until concluded; and it is further,
Ordered that the matter is remitted to the Supreme Court, Kings County, for further proceedings consistent herewith.
The petitioner was admitted to the Kingsborough Psychiat*810ric Center (hereinafter Kingsborough) on November 27, 1995, pursuant to Mental Hygiene Law § 9.39, which provides for a 15-day emergency retention of an individual alleged to have a mental illness who, inter alia, presents a substantial risk of physical harm to himself or to others. In order to continue to hold the petitioner as an involuntary patient, the respondent was required to apply for the involuntary admission of the petitioner upon medical certification within that 15-day period (see, Mental Hygiene Law § 9.39 [b]; § 9.27). Before the expiration of 60 days from the petitioner’s initial hospitalization, the respondent was required to apply to the Supreme Court for an order authorizing his continued retention upon medical certification (see, Mental Hygiene Law §§ 9.33, 9.39 [b]; Savastano v Nurnberg, 152 AD2d 290, affd 77 NY2d 300). The respondent did not apply for the involuntary admission of the petitioner until January 3, 1996, which was past the 15-day deadline, and the respondent did not apply for a retention order until February 2, 1996, which was 7 days past the statutory deadline. The petitioner moved to dismiss the retention application and commenced this proceeding for a writ of habeas corpus on February 7, 1996, in which he alleged that his continued involuntary retention was illegal.
During the proceedings on the writ in the Supreme Court, the respondent initially conceded that Kingsborough did not have authority under the statute to retain the petitioner as an involuntary patient. The matter was subsequently adjourned twice at the respondent’s request in order to give Kingsborough an opportunity to prepare an adequate discharge plan and for a hearing, if necessary. On March 5, 1996, the court found that the discharge plan submitted by Kingsborough was inadequate. In view of the evidence of the petitioner’s mental condition, the court adjourned the matter to obtain a more complete report and signed a temporary order of retention until March 21, 1996. On March 21, 1996, the Supreme Court dismissed the writ as academic based on the representation of the respondent’s counsel that the petitioner was discharged from Kingsborough to the custody of his mother on March 11, 1996, and that he was subsequently readmitted to Kingsborough on an emergency basis, thus starting the statutory time limits running anew. The court’s order made no reference to the pending retention application.
We conclude that the Supreme Court erred in dismissing the writ as academic. The record establishes that the petitioner’s "discharge” from Kingsborough was a transparent attempt by the respondent to avoid the legal consequences of the failure to *811follow statutory procedures. The respondent did not dispute the petitioner’s allegations that he was transported in handcuffs from Kingsborough to the Kings County Hospital emergency room, that he was, admitted to that hospital overnight for evaluation, and that he was readmitted to Kings-borough the next day.
The record establishes that the petitioner was illegally detained when he commenced this proceeding (see, e.g., People ex rel. Jacobs v Director of Gowanda State Hosp., 19 AD2d 858, affd 14 NY2d 663). Because civil commitment constitutes a significant deprivation of liberty (see, Addington v Texas, 441 US 418), the respondent’s failure to comply with the statute cannot be condoned. Nevertheless, under the circumstances of this case, we do not agree with the petitioner that the respondent’s retention application should be dismissed or that his immediate discharge is the required remedy for the respondent’s failure to comply with statutory procedures (see, e.g., Namor v Lopez, 143 Misc 2d 469 [in light of the allegations as to the petitioner’s psychiatric condition, the writ was sustained unless the petition for retention was filed within one day]; cf., People ex rel. Thorpe v Von Holden, 63 NY2d 546, 555 [proper disposition of a writ application in a case involving a commitment pursuant to CPL 330.20 may be a conditional release unless an expeditious hearing is held on a retention application]).
The State has an interest in providing care to the mentally ill and in preventing violence to the mentally ill and others (see, Addington v Texas, supra; Project Release v Prevost, 722 F2d 960; Matter of Harry M., 96 AD2d 201). Mental Hygiene Law § 33.15 (b) provides that, upon the return of a writ of habeas corpus, the court "shall examine the facts concerning the person’s alleged mental disability and detention”. The court is authorized to consider the patient’s medical records and hear testimony, and the court "shall discharge the person so retained if it finds that he is not mentally disabled or that he is not in need of further retention for in-patient care and treatment” (Mental Hygiene Law § 33.15 [£]; see also, Matter of Mental Hygiene Legal Servs. v Wack, 75 NY2d 751; Matter of Mental Hygiene Legal Servs. ex rel. James U. v Rhodes, 195 AD2d 160). Here, rather than dismissing the writ, the Supreme Court should have considered the merits of the respondent’s pending retention application.
The writ is reinstated and sustained to the extent that the petitioner shall be released from Kingsborough unless the Supreme Court commences a hearing within 15 days of this Court’s decision and order to determine whether the petitioner
*812is mentally disabled or in need of further retention for inpatient care and treatment. The hearing shall be held on successive court days without substantial interruption until concluded.
O’Brien, J. P., Thompson, Altman and Krausman, JJ., concur.