
869 P.2d 207 (1994)
Terence Keijiro JACOBS, Petitioner-Appellant,
v.
Harold CARMEL, Respondent-Appellee.
No. 93SA20.
Supreme Court of Colorado, En Banc.
February 14, 1994.
Rehearing Denied March 7, 1994.
Terence Keijiro Jacobs, pro se.
Gale A. Norton, Atty. Gen., Raymond T. Slaughter, Chief Deputy Atty. Gen., Timothy M. Tymkovich, Sol. Gen., Paul Farley, Deputy Atty. Gen., John August Lizza, First Asst. Atty. Gen., Stacy L. Worthington, Asst. Atty. Gen., Human Resources Section, Denver, for respondent-appellee.
Justice LOHR delivered the Opinion of the Court.
Terence Keijiro Jacobs appeals from a judgment of the Pueblo County District Court denying his petition for a writ of habeas corpus. We affirm the district court's judgment.

I
In 1983, Jacobs was charged in El Paso County District Court with the offenses of attempt to commit first degree murder, §§ 18-3-102 and 18-2-101, 8 C.R.S. (1978 & *208 1983 Supp.), first degree assault, § 18-3-202, 8 C.R.S. (1978 & 1983 Supp.), and crime of violence, § 16-11-309, 8 C.R.S. (1978 & 1983 Supp.). Jacobs, who was represented by counsel, pleaded not guilty by reason of insanity. By stipulation, the issue was tried to the court. Following an evidentiary hearing the court found Jacobs not guilty by reason of insanity and committed him to the custody of the Director of the Department of Institutions in accordance with section 16-8-105(4), 8 C.R.S. (1978) (now section 16-8-105(4), 8A C.R.S. (1986)).
Jacobs sought relief from the order of commitment under Crim.P. 35(c) by a motion filed in El Paso County District Court asserting that he was not advised of the effect and consequences of his plea and that he was denied effective assistance of counsel. Jacobs contended that as a result of these alleged deficiencies in the commitment proceedings, he should be permitted to withdraw his plea.
The district court denied the motion without a hearing, and the Colorado Court of Appeals affirmed. See People v. Jacobs, No. 91CA0393 (Colo.App. Feb. 13, 1992) (not selected for publication), cert. denied, No. 92SC239 (Colo. July 27, 1992). The court of appeals noted that a Crim.P. 35(c) motion may be denied without a hearing if the motion, the files, and the record clearly establish that the moving party is not entitled to relief. Id., slip op. at 1. The court of appeals noted that Jacobs claimed that he was not fully advised by the court of the effect and consequences of his plea of not guilty by reason of insanity, specifically that if the plea was sustained, he would be committed to the Colorado State Hospital until found eligible for release. Id. The court of appeals also noted that Jacobs asserted that he was denied effective assistance of counsel because his counsel did not advise him of the effect and consequences of a plea of not guilty by reason of insanity. Id. at 1-2. The court of appeals observed, however, that the entry of plea form accompanying Jacobs's Crim.P. 35(c) motion and dated April 3, 1985, contained a statement in Jacobs's own handwriting stating as follows: "`Furthermore that a finding of defendant insan[e] may result in his confinement in an institution for the criminal[ly] insane for an indeterminate period of time, possibly even the remainder of his natural life.'" Id. at 2 [brackets in court of appeals' opinion].
The court of appeals also noted that Jacobs's counsel, without objection by him, entered the plea in open court on May 3, 1985. The court of appeals held that the motion clearly established that Jacobs was not entitled to relief and therefore the district court properly denied the motion without a hearing. Id. We denied Jacobs's petition for writ certiorari to the court of appeals on July 27, 1992.
On September 18, 1992, Jacobs filed a pro se petition for a writ of habeas corpus in the Pueblo County District Court, the venue within which he is confined, naming as respondents the Colorado Department of Institutions and Harold Carmel, M.D., Superintendent of Colorado Mental Health Institute at Pueblo, asserting that he is being illegally detained because the alleged failure of the El Paso County District Court to advise him of the nature and consequences of his plea of not guilty by reason of insanity violated his rights to due process of law and equal protection of the laws under the Fifth and Fourteenth Amendments to the United States Constitution and Article II, section 25, of the Colorado Constitution. Jacobs asserted as well that he was denied effective assistance of counsel as guaranteed by the Sixth Amendment to the United States Constitution and Article II, section 16, of the Colorado Constitution because counsel "failed to conduct pretrial investigation into the case against Petitioner and permitted a witness to commit perjury on the stand during the sanity trial." These are essentially the same grounds for relief that Jacobs asserted in his Crim.P. 35(c) motion.
On December 14, 1992, the district court ordered that a writ of habeas corpus issue returnable on December 22. Prior to the scheduled hearing the Department of Institutions and the Superintendent moved "to dismiss the Petition for Writ of Habeas Corpus" on the basis that it raised the same issues presented and resolved unfavorably to Jacobs in People v. Jacobs. On December 22 *209 the district court heard arguments by telephonic conference with Jacobs and an attorney for the Department and the Superintendent. It determined that the improper advisement claim was precisely the same claim resolved against Jacobs in People v. Jacobs. As to the ineffective assistance of counsel claim, the district court found that because Jacobs was found not guilty by reason of insanity his plea was sustained and he could not have been prejudiced by ineffective assistance of counsel. The district court therefore held that the petition for writ of habeas corpus was without merit and the writ had been improvidently issued. Accordingly, it ordered the writ withdrawn and the petition for writ of habeas corpus denied.
Jacobs appealed the district court's order, asserting that the district court erred by not following the procedures prescribed in the Habeas Corpus Act in determining the merits of the issues he raised and by denying an evidentiary hearing on his claim of ineffective assistance of counsel. We conclude, however, that we need not address these issues because the relief Jacobs seeks may not be obtained by writ of habeas corpus. We therefore affirm the judgment denying the writ of habeas corpus but on grounds different than those advanced by the district court.

II
The essential purpose of habeas corpus is to determine whether a person is unlawfully detained. Duran v. Price, 868 P.2d 375, at 377 (Colo.1994); Kailey v. Colorado State Dep't of Corrections, 807 P.2d 563, 566 (Colo.1991). However, "[h]abeas corpus is an appropriate remedy to redress an unlawful restraint of one's liberty when no other form of relief is available." Kailey, 807 P.2d at 566. Habeas corpus relief is thus not available when other legal remedies exist, such as a motion under Crim.P. 35. Mulkey v. Sullivan, 753 P.2d 1226, 1232 (Colo.1988). We have not previously considered whether relief may be obtained by habeas corpus when the petitioner alleges defects arising from proceedings in the district court leading to the court's acceptance of the petitioner's plea of not guilty by reason of insanity to criminal charges.
If a person is found not guilty by reason of insanity, "the court shall commit the defendant to the custody of the department of institutions until such time as he is found eligible for release." § 16-8-105(4), 8A C.R.S. (1986). We have recognized the significant differences between the commitment procedures following an adjudication of criminal insanity and civil commitment procedures. People v. Chavez, 629 P.2d 1040, 1052 (Colo.1981). "[T]hese differences are justified by the public safety interests involved in an insanity adjudication." Id. at 1052-53. Although a person committed under section 16-8-105(4) will not actually have been convicted of the crime charged, his plea of not guilty by reason of insanity "is a plea in the nature of confession and avoidance ... [and] [t]he defendant's denial of guilt is predicated on a claim of mental disease or defect which, by reason of its existence, relieves him of criminal responsibility for his conduct." Chavez, 629 P.2d at 1047. Section 13-45-102, 6A C.R.S. (1987), pertaining to habeas corpus relief in civil cases, does not apply because of the significant differences between criminal and civil commitment.
We conclude for a number of reasons that a motion under Crim.P. 35(c), rather than habeas corpus, is the proper way for a petitioner to challenge the validity of his plea of not guilty by reason of insanity, and to raise a claim of ineffective assistance of counsel in the criminal proceeding leading up to the petitioner's criminal insanity commitment.
First, the grounds on which a court may inquire by writ of habeas corpus into the legality or justice of a judgment or decree of a legally constituted court are limited:
(2) If it appears that the prisoner is in custody by virtue of process from any court legally constituted, he can be discharged only for some of the following causes:
(a) Where the court has exceeded the limit of its jurisdiction, either as to the matter, place, sum, or person;
(b) Where, though the original imprisonment was lawful, yet by some act, omission, or event which has subsequently taken place, the party has become entitled to his discharge;

*210 (c) Where the process is defective in some substantial form required by law;
(d) Where the process, though in proper form, has been issued in a case or under circumstances where the law does not allow process or orders for imprisonment or arrest to issue;
(e) Where, although in proper form, the process has been issued or executed by a person either unauthorized to issue or execute the same or where the person having the custody of the prisoner under such process is not the person empowered by law to detain him;
(f) Where the process appears to have been obtained by false pretense or bribery;
(g) Where there is no general law, nor any judgment, order, or decree of a court to authorize the process, if in a civil suit, nor any conviction if in a criminal proceeding.
§ 13-45-103(2), 6A C.R.S. (1987). The above grounds are exclusive. "No court on the return of a habeas corpus shall inquire into the legality or justice of a judgment or decree of a court legally constituted, in any other manner." § 13-45-103(3), 6A C.R.S. (1993 Supp.).
Jacobs alleges that he is entitled to habeas corpus relief because the order of commitment "is defective in some substantial form required by law." See § 13-45-103(2)(c), 6A C.R.S. (1987). Jacobs's allegations, however, go behind the form of the process under which he was committed. Jacobs does not contend that there is a substantial defect in the form itself of the commitment judgment.
Second, Jacobs's claims are commonplace in Crim.P. 35(c) proceedings. We have held that allegations by a petitioner that his guilty plea was coerced, that he was not afforded the benefit of counsel, and that the court, when accepting the guilty plea, did not advise the petitioner of the sentence provided by law for the crime charged, did not raise questions justiciable in habeas corpus, but that the proper remedy was by motion under Crim.P. 35. Stewart v. Tinsley, 157 Colo. 441, 442, 403 P.2d 220, 220 (1965). Similarly, assertions of ineffective assistance of counsel are properly addressed by a Crim.P. 35(c) motion. People v. Thomas, 867 P.2d 880, at 886 (Colo.1994).
Third, a motion for relief under Crim.P. 35(c) is brought in the court rendering the sentence, Crim.P. 35(c)(3), and the proper parties are the same as in the underlying criminal proceeding, the petitioner and the People. The venue and the parties in a postconviction motion are therefore appropriate to resolve claims pertaining to the validity of the criminal procedures resulting in commitment.
On the other hand, "[t]he only parties to a habeas corpus proceeding are the petitioner and the person holding the petitioner in custody...." Johnson v. Gunter, 852 P.2d 1263, 1265 (Colo.1993). This habeas corpus proceeding was brought in the District Court, County of Pueblo, the county in which Jacobs is committed, and the named respondents are the Colorado Department of Institutions and the Superintendent of the Colorado Mental Health Institute at Pueblo. The named respondents have only an indirect connection to Jacobs's claims.
Finally, although the literal language of Crim.P. 35(c) talks of remedies afforded those convicted of a crime, we believe that the rule is broad enough to address Jacobs's claims. Crim.P. 35(c) is set out in the margin.[1] Jacobs is not prejudiced by our holding today since he initially sought relief by way of Crim.P. 35(c), and the district court and the court of appeals assumed that such a postconviction motion was procedurally proper.


*211 III
If it appears from the face of a petition that the petitioner is not entitled to habeas corpus relief, the petition may properly be denied without a hearing. Stewart, 157 Colo. at 442, 403 P.2d at 220. Since Jacobs's petition requested relief not cognizable by habeas corpus, the district court did not err in denying the petition without holding an evidentiary hearing. The judgment of the district court is therefore affirmed.[2]
NOTES
[1]  Rule 35. Post conviction Remedies

. . . . .
(c) Other Remedies.
(1) If, prior to filing for relief pursuant to this paragraph (1), a person has sought appeal of a conviction within the time prescribed therefor and if judgment on that conviction has not then been affirmed upon appeal, that person may file an application for postconviction review upon the ground that there has been a significant change in the law, applied to the applicant's conviction or sentence, allowing in the interests of justice retroactive application of the changed legal standard.
(2) Notwithstanding the fact that no review of a conviction of crime was sought by appeal within the time prescribed therefor, or that a judgment of conviction was affirmed upon appeal, every person convicted of a crime is entitled as a matter of right to make application for postconviction review upon the grounds hereinafter set forth. Such an application for postconviction review must, in good faith, allege one or more of the following grounds to justify a hearing thereon:
(I) That the conviction was obtained or sentence imposed in violation of the Constitution or laws of the United States or the constitution or laws of this state;
(II) That the applicant was convicted under a statute that is in violation of the Constitution of the United States or the constitution of this state, or that the conduct for which the applicant was prosecuted is constitutionally protected;
(III) That the court rendering judgment was without jurisdiction over the person of the applicant or the subject matter;
(IV) That the sentence imposed exceeded the maximum authorized by law, or is otherwise not in accordance with the sentence authorized by law;
(V) That there exists evidence of material facts, not theretofore presented and heard, which, by the exercise of reasonable diligence, could not have been known to or learned by the defendant or his attorney prior to the submission of the issues to the court or jury, and which requires vacation of the conviction or sentence in the interest of justice;
(VI) Any grounds otherwise properly the basis for collateral attack upon a criminal judgment; or
(VII) That the sentence imposed has been fully served or that there has been unlawful revocation of parole, probation, or conditional release.
(3) One who is aggrieved and claiming either a right to be released or to have a judgment of conviction set aside on one or more of the grounds enumerated in section (c)(2) of this Rule may file a motion at any time in the court which imposed sentence to vacate, set aside, or correct the sentence, or to make such order as necessary to correct a violation of his constitutional rights. Unless the motion and the files and record of the case show to the satisfaction of the court that the prisoner is not entitled to relief, the court shall cause a copy of said motion to be served on the prosecuting attorney, grant a prompt hearing thereon, and take whatever evidence is necessary for the disposition of the motion. In all cases, the court shall determine the issues and make findings of fact and conclusions of law with respect thereto.
If the court finds that defendant is entitled to postconviction relief, the court shall vacate and set aside the judgment, impose a new sentence, or grant a new trial, or discharge the prisoner, or make such orders as may appear appropriate to restore a right which was violated. The court may stay its order for discharge of the prisoner pending appellate court review of the order. If the court orders a new trial, the transcript of testimony given at the trial, which resulted in the vacated sentence by witnesses who have since died or otherwise become unavailable, may be used at the new trial. The court need not entertain a second motion or successive motions for similar relief based upon the same or similar allegations on behalf of the same prisoner. The order of the trial court granting or denying the motion is a final order reviewable on appeal.
[2]  After determining that relief was not available by habeas corpus, we have sometimes treated the habeas corpus petition as a motion under Crim.P. 35(c). See, e.g., Kailey v. Colorado State Dep't of Corrections, 807 P.2d 563, 567 (Colo. 1991); White v. Denver Dist. Court, 766 P.2d 632, 634 (Colo.1988). There is no need to convert the present petition to a motion for postconviction relief, however, because the appellant raised the same issues in his previous motion under Crim.P. 35(c) that he raises here. See Johnson v. Gunter, 852 P.2d 1263, 1265-66 (Colo.1993) (defective habeas corpus petition need not be converted to Crim.P. 35(c) motion where same petitioner had already filed motion for postconviction relief in proper court).
