
7 N.Y.3d 607 (2006)
859 N.E.2d 508
825 N.Y.S.2d 702
STATE OF NEW YORK ex rel. STEPHEN J. HARKAVY, on Behalf of JOHN DOE Nos. 1 THROUGH 12, Appellant,
v.
EILEEN CONSILVIO, as Executive Director of Manhattan Psychiatric Center and KIRBY FORENSIC PSYCHIATRIC CENTER, Respondent.
Court of Appeals of New York.
Argued October 11, 2006.
Decided November 21, 2006.
*608 Mental Hygiene Legal Service, First Judicial Department, New York City (Sadie Zea Ishee, Stephen J. Harkavy and Karen Gomes Andreasian of counsel), for appellant.
*609 Eliot Spitzer, Attorney General, New York City (Caitlin J. Halligan, Daniel Smirlock and Benjamin N. Gutman of counsel), for respondent.
Chief Judge KAYE and Judges ROSENBLATT, GRAFFEO, READ, SMITH and PIGOTT concur with Judge CIPARICK; Judge SMITH concurs in a separate opinion.


*610 OPINION OF THE COURT
CIPARICK, J.
The issue presented by this appeal is whether the procedure employed by the State in involuntarily committing certain sex offenders leaving the custody of the Department of Correctional Services (DOCS) was proper. In the absence of specific statutory authority governing the release of felony offenders from prison to a psychiatric hospital, we hold that the procedures set forth in Correction Law § 402, rather than Mental Hygiene Law article 9, better suit this situation.
Petitioners were in the custody of DOCS, and nearing the end of their prison sentences for various felony sex offenses, when they were examined by two Office of Mental Health (OMH) physicians for the purpose of involuntary commitment to an OMH facility. The OMH physicians certified that each petitioner suffered from a mental illness and that without inpatient psychiatric treatment, each posed a high risk of recommitting sexual crimes if released into the community. The prison superintendents completed applications for involuntary commitment on medical certification, pursuant to Mental Hygiene Law § 9.27. As petitioners' prison terms expired, they were each transported under guard to the Manhattan Psychiatric Center (MPC), where each was further examined by a third OMH physician who also found involuntary commitment necessary.
Mental Hygiene Legal Service initiated this habeas corpus proceeding on behalf of petitioners seeking their immediate release. Petitioners argued that since they were undergoing a sentence of imprisonment, it was illegal for the State to transfer them into the mental health system pursuant to article 9 of the Mental Hygiene Law. They argued that the State was required to comply with the procedures set forth in Correction Law § 402, which governs the commitment of mentally ill prisoners to psychiatric hospitals, and that a prison superintendent is not authorized to file an application for involuntary commitment.
The State contended that petitioners were no longer undergoing a sentence of imprisonment since they were either being conditionally released, being released to parole supervision, or being released because their term of imprisonment was about to expire. The State also argued that the provisions of Mental Hygiene Law § 33.15 govern this habeas corpus proceeding and that the habeas court is therefore required to examine the alleged mental illness of each petitioner in addition to any alleged procedural irregularities.
*611 Supreme Court granted the petition by ordering petitioners' conditional release, finding that the State's use of article 9 of the Mental Hygiene Law deprived petitioners of protections afforded to prisoners under the provisions of Correction Law § 402. Supreme Court opined that the State should have followed Correction Law § 402's involuntary commitment procedures, because each petitioner was in fact imprisoned at the time of his involuntary commitment. Additionally, Supreme Court held that a prison superintendent is an authorized applicant under Mental Hygiene Law § 9.27 (b). Supreme Court also held that this proceeding was improperly brought under CPLR article 70, but granted a conditional release order unless a retention hearing was begun and concluded expeditiously.
The Appellate Division reversed, on the law, vacated the order for conditional release and dismissed the petition. The Appellate Division concluded that the State properly committed the petitioners under Mental Hygiene Law article 9, holding that since Correction Law § 402 "applies only to persons undergoing a sentence of imprisonment, it contemplates return to a DOCS facility" (29 AD3d 221, 225 [2006]), whereas these petitioners were not returning to DOCS custody but were instead soon to be released. Furthermore, the Appellate Division agreed with Supreme Court that petitioners should have brought this petition pursuant to the more specific habeas corpus provision in Mental Hygiene Law § 33.15, and that Supreme Court erred by "conditionally releasing petitioners without conducting its own review as to the state of each individual's mental disability" (29 AD3d at 228) as required by Mental Hygiene Law § 33.15. We disagree with the Appellate Division's conclusion that the article 9 procedure was proper and therefore reverse, remitting the matter to Supreme Court for further proceedings.
As a preliminary matter, we agree with the courts below that prison superintendents would have been proper persons to execute the applications for involuntary commitment. However, we disagree that proceeding under the Mental Hygiene Law was proper, since petitioners were still prison inmates and therefore subject to the provisions of the Correction Law at the time the applications were initiated.
The Mental Hygiene Law provides that "[u]nless otherwise specifically provided for by statute, a mentally ill person shall be admitted to a hospital as an in-patient only pursuant to the provisions of this article" (Mental Hygiene Law § 9.03). Mental Hygiene Law § 9.27 (a) authorizes the involuntary hospitalization *612 of persons who are mentally ill, are in need of involuntary care and treatment and present a danger to themselves or society. This is effectuated by the certification of mental illness and need for involuntary care and treatment by two physicians (see Mental Hygiene Law § 9.27 [a]), followed by the submission by a statutorily designated person of an application for involuntary commitment on medical certification (see Mental Hygiene Law § 9.27 [b], [c]) and a confirmatory examination to be performed by a physician at the receiving psychiatric facility (see Mental Hygiene Law § 9.27 [e]). After commitment, the patient may request a hearing before a court on the issue of the need for hospitalization (see Mental Hygiene Law § 9.31). No such hearings were requested here.
Petitioners argue that at the time they were evaluated for involuntary commitment, and eventually committed, they were "undergoing a sentence of imprisonment," requiring the State to follow Correction Law § 402, which governs the transfer of mentally ill prisoners to psychiatric hospitals. The commitment procedures of Correction Law § 402 differ from Mental Hygiene Law § 9.27 in that Correction Law § 402 requires that the prison superintendent must first apply to a court for the appointment of two examining physicians[*] to conduct psychiatric examinations of the inmate (see Correction Law § 402 [1]), and if they certify that the inmate is mentally ill and in need of psychiatric care and treatment, then the superintendent must petition the court for a commitment order (see Correction Law § 402 [3]). Notice of the petition must be served upon the inmate, his or her closest friend or relative and the Mental Hygiene Legal Service (see id.). The inmate is then entitled to request a hearing before a judge before the transfer to a psychiatric hospital is undertaken (see Correction Law § 402 [5]). These procedural safeguards may be bypassed if the psychiatric admission sought is on an emergency basis (see Correction Law § 402 [9]).
Thus, in this case, the procedure employed pursuant to Mental Hygiene Law § 9.27 did not require that the psychiatric examinations underlying the patient's admission be performed by court-appointed physicians, nor did it provide for pretransfer notice to the inmate and others, nor did it afford an opportunity for a pretransfer hearing.
*613 We agree with Supreme Court's assessment that "the plain truth of the matter is that each of the petitioners were, in fact, imprisoned at the time of their civil commitment" (10 Misc 3d 851, 855 [2005]). Two of the petitioners' applications for commitment were submitted on the date of their release and the remaining 10 petitioners' applications were submitted from one to four days prior to their release. The Appellate Division erroneously stated that "a few hours or days remaining in the sentence of these individuals as of the time of the application did not . . . render them `person[s] undergoing a sentence of imprisonment'" (29 AD3d at 226). Because all the preliminary paperwork and examinations were completed during the sentence, the Correction Law should have been followed.
By providing that Correction Law § 402 applies to inmates "undergoing a sentence of imprisonment," the Legislature intended the procedures of Correction Law § 402 to be used to evaluate for commitment all imprisoned persons, regardless of when an inmate is scheduled to be released. Focusing only on whether a person remains imprisoned at the precise moment of commitment, rather than during the precommitment examination and application, renders the statute's procedural protections ineffective since they can be easily avoided, as was done here, by waiting until the person is nearing a release date. The psychiatric evaluation process preceding involuntary commitment under Correction Law § 402 is intended to benefit and "protect the prisoner from administrative abuse of discretion" (Matter of Lindner, 96 Misc 2d 234, 237 [Sup Ct, Oneida County 1978]). Thus, the Correction Law's statutory scheme is meant to protect an inmate throughout the evaluation process leading to involuntary commitment, absent an emergency as contemplated by Correction Law § 402 (9).
The State asserts that the Correction Law anticipates an inmate's return to DOCS, and that since petitioners were not being returned to DOCS, they could not properly have been involuntarily committed pursuant to the Correction Law. However, the Mental Hygiene Law and the Correction Law, working in tandem, provide a mechanism for an inmate's continued hospitalization beyond the expiration of sentence. An inmate committed to a psychiatric facility who is nearing the end of a term of imprisonment may, on application by the director of the hospital, be admitted to the care of the OMH pursuant to the Mental Hygiene Law (see Correction Law § 404). Thus, the Correction Law applies not only when DOCS anticipates the *614 inmate's return but also when it anticipates that an inmate's sentence may expire while treatment is ongoing.
In the future, because inmates who are incarcerated do not pose an immediate threat to the community, there should be ample time to proceed under the Correction Law. Therefore, in the absence of a clear legislative directive in regard to inmates nearing their release from incarceration, we believe that Correction Law § 402 is the appropriate method for evaluating an inmate for postrelease involuntary commitment to a mental facility. Once the sentence expires, however, any further proceedings concerning the continued need for hospitalization are governed by the Mental Hygiene Law.
In conclusion, we understand how in an attempt to protect the community from violent sexual predators, the State proceeded under the Mental Hygiene Law. We do not propose that these petitioners be released, nor do we propose to trump the interests of public safety. Rather, we recognize that a need for continued hospitalization may well exist. We therefore order that those petitioners remaining in OMH custody be afforded an immediate retention hearing pursuant to article 9 of the Mental Hygiene Lawnow controllingsince they are no longer serving a prison sentence (see Correction Law § 404 [1]). As to future candidates for immediate psychiatric hospitalization, prior to the expiration of a term of imprisonment, the State must proceed pursuant to Correction Law § 402, with all its attendant procedural requirements including court supervision, pretransfer notice and an opportunity to be heard within a reasonable period of time prior to the inmate's proposed release date.
Accordingly, the order of the Appellate Division should be reversed, without costs, and the matter remitted to Supreme Court for further proceedings in accordance with this opinion.
R.S. SMITH, J. (concurring).
I join the Court's unanimous opinion, but add a brief explanation.
As the Court says, we have no "clear legislative directive" (majority op at 614). The situation of prison inmates whom the State seeks to confine upon the expiration of their terms is not specifically addressed by any statute, and neither Correction Law § 402 nor article 9 of the Mental Hygiene Law fits the situation perfectly. I think the Court is correct in choosing section 402, in part because that statute provides for a hearing before *615 confinement. The Mental Hygiene Law does not, and if applied to this case it would raise serious constitutional problems.
We upheld the Mental Hygiene Law's provisions for involuntary admission of certain mental patients against a constitutional challenge in Fhagen v Miller (29 NY2d 348 [1972]). In doing so, we rejected the argument that the statutes were invalid because they permitted the State to confine a person first, and give him a hearing afterward. We explained:
"Due process does, ordinarily, demand reasonable notice and an opportunity to be heard in advance of confinement or restraint. However, as we declared in Matter of Coates (9 N Y 2d 242, 249), `where immediate action is necessary for the protection of society and for the welfare of the allegedly mentally ill person, [it] does not require notice or hearing as a condition precedent to valid temporary confinement.'" (Id. at 353.)
It is hard to see how this reasoning can apply to a case like the present one. Petitioners had all been in prison for years before the State sought to commit them civilly. No sudden, unforeseen emergency required their confinement in a mental hospital. Since it cannot be said in this case that "immediate action [was] necessary for the protection of society," a strong argument can be made that petitioners were constitutionally entitled to a hearing before being deprived of the liberty that they would otherwise have obtained upon the completion of their prison terms. Because Correction Law § 402 provides for such a predeprivation hearing, I agree with the Court in holding it to be the applicable statute.
Order reversed, etc.
NOTES
[*]  "Examining physician" is defined in Correction Law § 400 (1) as "a physician licensed to practice medicine in the state of New York, but who is not on the staff of the facility where the inmate is confined."
