Ordinarily, habeas corpus may not be used as a substitute for appeal to challenge the involuntary commitment of an individual pursuant to R.C. 5122.15. Youngs v. Rogers (1981), 65 Ohio St. 2d 27 [19 O.O.3d 223]. However, habeas corpus may be used when challenging the jurisdiction of the court which ordered confinement, regardless of the availability of appeal. In re Lockhart (1952), 157 Ohio St. 192 [47 O.O. 129]. As petitioner is challenging the jurisdiction of the committing court, habeas corpus is an appropriate remedy.
R.C. 2945.40(A) provides that if a person is found not guilty by reason of insanity, the trial court shall conduct a full hearing to determine whether the person is a mentally ill person subject to hospitalization by court order. Generally, the hearing is to be conducted in accordance with the provisions of R.C. 5122.15, which set out the procedures for hearings regarding the involuntary commitment of the mentally ill.
Petitioner was acquitted of charges of felonious assault by reason of insanity. The trial court then found petitioner to be mentally ill, and ordered petitioner committed for an initial period not to exceed ninety days pursuant to R.C. 2945.40 and 5122.15(C).
R.C. 5122.15(H) provides for determinations regarding the continuance of commitment or discharge at the end of the ninety days. In pertinent part, the section provides:
“If, at the end of the first ninety-day period or any subsequent period of continued commitment, there has been no disposition of the case, either by discharge or voluntary admission, the hospital, facility, or person shall *316discharge the patient immediately, unless at least ten days before the expiration of the period the designee of the attorney general or the prosecutor files with the court an application for continued commitment. * * *”
The section also contains an important limitation relevant hereto:
“* * * Whenever a hospital, facility, or person intends to discharge a person who was found not guilty by reason of insanity and whose commitment was pursuant to section 2945.40 of the Revised Code, the head of the hospital * * * shall not discharge the person until he has complied with division (F) of section 2945.40 of the Revised Code.”
R.C. 2945.40(F) provides:
“Before discharging, releasing, authorizing a trial visit for, or transferring a person committed under this section, the head of the hospital * * * shall send written notice by certified mail, return receipt requested, to the trial court in which the person was found not guilty by reason of insanity, the attorney general, and the prosecutor, advising the trial court, .the attorney general, and the prosecutor of the proposed discharge, release, trial visit, or transfer. The notice shall include the hospital’s or facility’s report on the current status of the person and its recommendations concerning the pending action.”
Thus, those originally committed after being found not guilty by reason of insanity may not be lawfully discharged in the absence of notice to the trial court. This special notice requirement is designed to guard against inadvertent or misguided release of individuals who pose a particularly great threat to the safety of the public. R.C. 2945.40 and 5122.15 are replete with provisions, applicable only to those acquitted because of insanity, which ensure that extensive control will continue to. be exercised over the individual by the trial court wherein he was acquitted and found to be mentally ill.1 These provisions evidence a clear intent that the trial court is to have continuing jurisdiction.
Accordingly, we hold that the trial court has jurisdiction to decide questions relating to the continued commitment of a person committed pursuant to R.C. 2945.40 after being found not guilty by reason of insanity, and such jurisdiction continues until the time of lawful discharge.
As the trial court had jurisdiction to order the continued commitment of petitioner, the writ of habeas corpus must be denied.
Accordingly, the judgment of the court of appeals is affirmed.
Judgment affirmed.
Celebrezze, C.J., W. Brown, Sweeney, Locher, Holmes and C. Brown, JJ., concur.See, e.g., R.C. 5122.15(G)(2) and 2945.40(H) which prohibit a person found not guilty by reason of insanity from voluntarily committing himself, thus preventing the individual from circumventing the special provisions applicable to those committed after acquittal by reason of insanity. R.C. 2945.40(D)(4) requires that upon the contemplated release of the person acquitted by reason of insanity, notice shall be given to, among others, the trial court.