
753 P.2d 1226 (1988)
Arthur M. MULKEY, Petitioner-Appellee,
v.
Patrick SULLIVAN, Sheriff of Arapahoe County, State of Colorado, Respondent-Appellant.
No. 86SA118.
Supreme Court of Colorado, En Banc.
April 18, 1988.
*1227 David F. Vela, State Public Defender, Linda Hotes, Deputy State Public Defender, Littleton, for petitioner-appellee.
Charles H. Richardson, Stacie G. Flanders, Michael J. Hyman, Aurora, for respondent-appellant.
VOLLACK, Justice.
The respondent-appellant, Arapahoe County Sheriff Patrick Sullivan, brings a direct appeal to this court from the Arapahoe County District Court's order releasing the defendant from the sheriff's custody, as a result of the defendant's successful petition for a writ of habeas corpus.[1] We agree with the district court that the defendant's advisement at the providency hearing was constitutionally inadequate, but affirm the district court's order under Colorado Municipal Court Rule 235, rather than as a proceeding in habeas corpus.

I.
In October 1985, Arthur Mulkey (Mulkey or the defendant), was arrested by the Aurora Police Department and charged with eight criminal violations of the Aurora Municipal Code.[2] Mulkey received his initial advisement in the Aurora Municipal Court Building when an audio and videotaped advisement was shown to him and a number of other inmates as a group. He then *1228 appeared before a municipal court judge, entered pleas of not guilty to all charges, and set a date for trial. When the defendant appeared in court on his trial date a month later, however, he pled guilty to all charges. The municipal court judge advised Mulkey of certain rights and accepted his guilty pleas. Mulkey was sentenced to 180 days incarceration in the Arapahoe County Jail on each of seven counts,[3] terms to run consecutively, which resulted in a total sentence of 1,260 days. When Mulkey entered his guilty pleas, he was not represented by counsel, nor was he advised by the court that he had the right to a lawyer if he could not afford to hire one.
While incarcerated in the Arapahoe County Jail,[4] the defendant filed a Petition for Writ of Habeas Corpus in Arapahoe County District Court, asserting that his detention was illegal because he had not been represented by counsel when he entered his pleas, could not afford private counsel, and was not advised of his right to court-appointed counsel. The district court issued an Order for Writ of Habeas Corpus and held a hearing. After hearing Mulkey's testimony, the district court ruled that he was being detained on an illegal sentence, made absolute the Writ of Habeas Corpus, and ordered the Arapahoe County Sheriff to discharge Mulkey from custody. In so holding, the court ruled that under Colorado Municipal Court Rule 232 the defendant could not file a motion to withdraw his guilty plea. The court concluded, therefore, that Mulkey's Motion to Withdraw a Plea of Guilty was "appropriately then before the Court on Writ of Habeas Corpus."
The Colorado Municipal Court Rules of Procedure became effective in 1970. The purpose and construction of the Municipal Rules is described as follows:
These rules are intended to provide for the just determination of all municipal charter and ordinance violations. They shall be construed to secure simplicity in procedure, fairness in administration, and the elimination of unjustifiable expense and delay.
C.M.C.R. 202, 7B C.R.S. (1984). Because the Municipal Rules represent a simplified version of the Criminal Rules, reference to the Criminal Rules is appropriate, in some circumstances, for analysis of the Municipal Rules.

II.

A. C.M.C.R. 211 & Crim.P. 11
The first issue we must decide is whether the district court correctly held that the municipal court's advisement of the defendant was unconstitutional. In its order, the district court reviewed Colorado Municipal Court Rule (C.M.C.R.) 211 and concluded that even though C.M.C.R. 211 did not contain the identical language found in Crim.P. 11, "there is nothing in the statute or rules that permit[s] a proceeding which violates an individual Constitutional right and the courts must interpret [C.M.C.R.] 211 in that regard." C.M.C.R. 211 is modeled on Crim.P. 11, which governs the entry of pleas in county and district courts. C.M.C.R. 211 provides in full:
Rule 211. Pleas
A defendant, personally or by counsel, may plead guilty, not guilty, or, with the consent of the court, nolo contendere. The court shall not accept the plea of guilty without first:
(1) Determining that the plea is made voluntarily with understanding of the nature of the charge; and
*1229 (2) Explaining fully to the defendant his right to trial by jury, his right to counsel, and the possible penalty provided by charter or ordinance for the offense charged.
If a defendant refuses to plead or if the court refuses to accept a plea of guilty, the court shall enter a plea of not guilty. If for any reason the arraignment here provided for has not been had, the case shall for all purposes be considered as one in which a plea of not guilty has been entered.
7B C.R.S. (1984) (emphasis added).
Under Crim.P. 11, when a defendant enters a guilty plea, the court must do the following:
(b) Pleas of Guilty and Nolo Contendere. The court shall not accept a plea of guilty or a plea of nolo contendere without first determining that the defendant has been advised of all the rights set forth in Rule 5(a)(2) and also determining:
(1) That the defendant understands the nature of the charge and the elements of the offense to which he is pleading and the effect of his plea;
(2) That the plea is voluntary on defendant's part and is not the result of undue influence or coercion on the part of anyone;
(3) That he understands the right to trial by jury and that he waives his right to trial by jury on all issues;
(4) That he understands the possible penalty or penalties;
(5) That the defendant understands that the court will not be bound by any representations made to the defendant by anyone concerning the penalty to be imposed or the granting or the denial of probation, unless such representations are included in a formal plea agreement approved by the court and supported by the findings of the presentence report, if any;
(6) That there is a factual basis for the plea. If the plea is entered as a result of a plea agreement, the court shall explain to the defendant, and satisfy itself that the defendant understands, the basis for the plea agreement, and the defendant may then waive the establishment of a factual basis for the particular charge to which he pleads; ...
7B C.R.S. (1984). These findings must be made before the trial court accepts a defendant's guilty plea to ensure that the defendant's plea is constitutionally entered. People v. Canino, 181 Colo. 207, 211, 508 P.2d 1273, 1275 (1973). While Crim.P. 11 does not require the use of a prescribed ritual or wording, People v. Cushon, 650 P.2d 527, 529 (Colo.1982), a trial court must adhere strictly to the rule's requirements in order to show that a plea is voluntarily and intelligently made. People v. Sandoval, 188 Colo. 431, 433, 535 P.2d 1120, 1121 (1975); Canino, 181 Colo. at 211, 508 P.2d at 1275.
This advisement was given to the defendant by the municipal court judge before the judge accepted Mulkey's plea of guilty:
BY THE COURT:
. . . .
Are you Mr. Mulkey?
A Yes.
Q You need to understand that resisting arrest, assault and battery each carry a maximum jail penalty of $999 fine, 180 days in jail or both the fine and imprisonment on each one of these charges. The charge of disorderly conduct, failure to obey a lawful [sic]; trespass on private property and refusal to leave when ordered and malicious injury to property valued less than $100 each carry penalties of a maximum of $500 fine, 180 days in jail or both the fine and imprisonment.
. . . .
The Court stands corrected, ... there are two charges of battery. You have got two counts and you are looking at a maximum of $999, 180 days in jail or both. There are two battery charges and there are also two malicious *1230 injury to property charges. Do you understand that you are facing eight charges here?
A (By the defendant) Nods head in the positive.
Q (By the Court) Are you ready for trial?
A I am ready to change my plea to guilty.
Q On all charges?
A Yes.
Q Do you understand that if you plead guilty to all charges, that the Court could sentence you to the maximum on all charges?
A Yes, sir.
Q In adding up all the charges with regard to maximum penalties, you are looking at almost $6,000 in fines and almost four years in a common jail. Do you understand that?
A Yes, sir.
Q Mr. Mulkey, you have to speak up.
A Yes, sir.
Q Mr. Mulkey, considering the maximum penalties that the Court could impose for a guilty plea on each one of these violations, do you want to maintain your guilty plea on each of the violations?
A Yes, sir.
Q Do you understand that by entering a plea of guilty, that you are giving up your right to a trial?
A Um-hum.
Q Do you understand you are giving up your right to be represented by an attorney?
A Yes, sir.
Q Do you understand you are giving up your right to be confronted by witnesses and to make the City prove its case against you, beyond a reasonable doubt, as to each of these violations?
A Yes, sir.
Q Are you pleading guilty because you are guilty?
A Yeah.
Q The Court is going to make a finding that the guilty plea on each of these charges is voluntary and the Court is going to accept the plea on each charge.
Following this advisement and the court's acceptance of the guilty pleas, the municipal court sentenced Mulkey to the maximum jail term of 180 days on each of the seven charges to which he pled guilty, to be served consecutively. Shortly thereafter, Mulkey filed the petition for writ of habeas corpus.
At the district court hearing on Mulkey's habeas corpus petition, the court reviewed the advisement and concluded that it was inadequate. The district court correctly noted that even though C.M.C.R. 211 presents a "standard somewhat different than [Crim.P.] 11.... [T]here is nothing in the statute or rules that permit[s] a proceeding which violates an individual Constitutional right and the courts must interpret Rule 211 in that regard." Mulkey was advised of the maximum penalties for each offense, and that he was giving up his right to trial, his right to be represented by an attorney, his right to be confronted by witnesses, and his right to require the City of Aurora to prove each charge against him beyond a reasonable doubt. The prosecution established a factual basis for each charge, and the court accepted Mulkey's guilty pleas on all charges and imposed sentence. The district court found the advisement insufficient, however, because the defendant was never told that he had a right to counsel, or that if he was indigent, he had the right to court-appointed counsel. The court ruled:
[T]he Court cannot find from the transcript of the proceeding and testimony that the Defendant's right to counsel was explained fully to him. It was stated that he was asked whether he understood that he was giving up his right to be represented by an attorney. The Defendant indicated, yes, in response to that. That is generally not an explanation in a full manner of the Defendant's right to be represented by counsel because *1231 it does overlook the fact that if indigent, the Court could have appointed counsel for him and that the Court would not proceed without counsel being present. The Court therefore concludes that the guilty pleas were not entered after a full explanation of the Defendant's rights to counsel, nor can the Court find from the record that the Defendant understood his right to counsel and the Court cannot conclude that the guilty plea was entered consistent with the Defendant's Constitutional right.
When an advisement does not meet these mandatory requirements, the guilty plea cannot appropriately be accepted and the judgment and sentence entered following the plea is illegal. People v. Randolph, 175 Colo. 454, 457, 488 P.2d 203, 204 (1971). The record of the providency hearing in this case shows that the trial court's ruling was correct.[5] Although Mulkey was advised of several rights and the possible penalties, he was not advised of his constitutional right to be represented by counsel. The trial court correctly ruled that the municipal court's advisement of Mulkey was illegal under C.M.C.R. 211.

B.

Habeas Corpus
Because Mulkey's advisement was inadequate, the court correctly concluded that Mulkey's guilty plea was unconstitutional. On that basis, the district court ruled that Mulkey's incarceration was illegal and ordered him released from jail on the writ of habeas corpus.
After sentence was imposed, the defendant was returned to Arapahoe County Jail where he was already serving a sentence on a prior conviction. His new sentence was not scheduled to begin until several days after the habeas corpus hearing. While serving the unrelated sentence, the defendant filed a Petition for Writ of Habeas Corpus, asserting that his detention was unlawful because he had been illegally sentenced on the seven charges.
The district court conducted a hearing on the habeas corpus petition. At the hearing, the court first held that under C.M.C.R. 232 "it is not possible for the Defendant at this time to be moving to withdraw his guilty plea in the Municipal Court Ruling," based on the language of C.M.C.R. 232 which states: "A motion to withdraw a plea of guilty or of nolo contendere may be made only before sentence is imposed." 7B C.R.S. (1984) (emphasis added). Without making reference to C.M.C.R. 235, the court then ruled that the action was "appropriately then before the Court on Writ of Habeas Corpus."
A habeas corpus proceeding is governed by statute. §§ 13-45-101 to -119, 6A C.R.S. (1987). It is a civil proceeding independent of the criminal charge. Evans *1232 v. District Court, 194 Colo. 299, 302, 572 P.2d 811, 813 (1977). The purpose of an action in habeas corpus is to determine whether the person instituting the proceeding is being unlawfully detained by the respondent who is holding him in custody. Ryan v. Cronin, 191 Colo. 487, 489, 553 P.2d 754, 755 (1976). As a result of this limited purpose, the issues in a habeas corpus proceeding are very narrow.
Several aspects of a habeas corpus proceeding lead us to the conclusion that it was not the correct procedure in this case. First, habeas corpus is an appropriate remedy where a conviction is void. Hart v. Best, 119 Colo. 569, 580, 205 P.2d 787, 793 (1949). Void judgments are subject to attack by use of habeas corpus; erroneous judgments are not. Ryan, 191 Colo. at 489, 553 P.2d at 755. When the court has jurisdiction over the subject matter and jurisdiction over the person, the judgment is not void. Hart, 119 Colo. at 580, 205 P.2d at 793. Here, it is not disputed that the municipal court had jurisdiction over both the subject matter and the defendant. For this reason, the judgment entered was not "void" for purposes of habeas corpus relief, and is therefore not subject to correction by habeas corpus.
Second, this court has previously ruled upon the appropriate remedy for a petitioner who raises the issue of constitutionally infirm advisements. In Stewart v. Tinsley, 157 Colo. 441, 442, 403 P.2d 220, 220 (1965), the petitioner argued that his guilty plea was constitutionally infirm for several reasons, including the court's alleged failure to advise him of his right to counsel.[6]Id. This court held "that petitioner raises no question properly justiciable in habeas corpus.... The allegations of the petition go to the validity of petitioner's plea of guilty and are properly to be brought under [Crim.P.] 35(b)." Id. This holding was applied in Martinez v. Tinsley, 158 Colo. 236, 238, 405 P.2d 943, 944 (1965) ("[S]uch a petition shows on its very face that the petitioner is not entitled to habeas corpus relief." (emphasis in original)).
Because Mulkey's guilty plea was constitutionally defective but the municipal court had jurisdiction over the subject matter and the defendant, the sentence imposed was illegal rather than void. This illegal sentence is not an appropriate subject for habeas corpus. We therefore conclude that the petitioner was not entitled to habeas corpus relief.
Before a defendant can seek a writ of habeas corpus, he must first exhaust his legal remedies. Garrett v. Knight, 173 Colo. 419, 421, 480 P.2d 569, 570 (1971). Mulkey raises the same issue that was presented to this court by the petitioners in Stewart and Martinez, so he had a legal remedy other than habeas corpus. As in Stewart, "[t]he allegations of the petition go to the validity of petitioner's plea of guilty and are properly to be brought under [Crim.P.] 35(b)." 157 Colo. at 442, 403 P.2d at 440.

C.

C.M.C.R. 235 and Crim.P. 35
Where the allegations of a habeas corpus petition go to the validity of the petitioner's guilty plea, the appropriate remedy is a motion to withdraw the plea pursuant to Crim.P. 35. If a sentence is illegal, the sentencing court may correct it at any time. People v. Bradley, 169 Colo. 262, 264, 455 P.2d 199, 200 (1969).
We have already noted that C.M.C.R. 211 is analogous to Crim.P. 11. Likewise, we look to Crim.P. 35 for a constitutional construction of C.M.C.R. 235, which provides:
Rule 235. Correction or Vacation of Sentence
Correction of Illegal Sentence. The court may correct an illegal sentence at any time. It may, on motion of defendant or on its own motion, correct a sentence not conforming to the applicable *1233 charter or ordinance violation, either by amending the sentence and record thereof, or, when circumstances require, by vacating the sentence previously imposed and resentencing the defendant.
7B C.R.S. (1984) (emphasis added). Crim.P. 35 provides for certain postconviction remedies, and permits a court at any time to either correct an illegal sentence, or correct a sentence imposed in an illegal manner. Crim.P. 35(c)(2) provides:
(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; ...
7B C.R.S. (1984).
C.M.C.R. 235 gives the municipal court power to correct "a sentence not conforming to the applicable charter or ordinance violation." At the outset, the rule provides that the court "may correct an illegal sentence at any time." A sentence imposed after the trial court's acceptance of a constitutionally infirm guilty plea is an illegal sentence. We therefore conclude, based on Stewart and the language of C.M.C.R. 235, that the municipal court had authority under C.M.C.R. 235 to permit the defendant to withdraw his guilty plea, although sentencing had already taken place.
Our conclusion is that the district court came to the correct result, but used an incorrect procedure. We affirm the district court's ruling that the guilty plea accepted here did not meet constitutional requirements. We also agree with the court's conclusion that the defendant could not be legally detained as a result of that guilty plea. We remand the case with directions to permit the defendant to withdraw his guilty plea in the municipal court under C.M.C.R. 235, and set the matter for further proceedings. We affirm the district court and remand for further proceedings in accordance with this opinion.
QUINN, C.J., specially concurs, and KIRSHBAUM, J., joins in the special concurrence.
QUINN, Chief Justice, specially concurring:
Insofar as the majority holds that Mulkey's guilty pleas were constitutionally infirm and could not serve as a basis for his further incarceration, I concur. I write separately because I believe that habeas corpus relief should be available to a person to secure his release from a constitutionally infirm three and one-half year sentence imposed by a municipal court when, as here, no remedy is available under the Colorado Municipal Court Rules (C.M.C.R.) to challenge the legality of his incarceration.
In the absence of a knowing, intelligent, and voluntary waiver of one's right to counsel, no person who is financially unable to afford counsel may be imprisoned for any offense, whether classified as petty, misdemeanor, or felony, unless that person has been represented by counsel at trial or at an arraignment in which a guilty plea is tendered. See Argersinger v. Hamlin, 407 U.S. 25, 92 S.Ct. 2006, 32 L.Ed.2d 530 (1972). An uncounseled guilty plea, in which an accused does not knowingly, intelligently, and voluntarily waive his right to counsel, cannot support a subsequent judgment of conviction and sentence to imprisonment.
Since the district court correctly ruled that the municipal court's advisement of Mulkey was constitutionally defective, it follows that the judgment of conviction was no less constitutionally infirm, as was the ensuing sentence based on the constitutionally invalid conviction. The majority, *1234 however, concludes that habeas corpus relief was not available because Mulkey had an effective remedy under C.M.C.R. 235. The majority reaches this conclusion by engrafting on C.M.C.R. 235 the same scope of postconviction relief available to an accused under Rule 35 of the Colorado Rules of Criminal Procedure. With this analysis I disagree.
The Colorado Rules of Criminal Procedure, including Crim.P. 35, are expressly inapplicable "to municipal ordinance and charter violations." Crim.P. 54(a). Under C.M.C.R. 232(d), Mulkey could have made a motion to withdraw his guilty plea only before, not after, the imposition of sentence. Once sentence was imposed, the only remedy available to Mulkey was a motion, filed pursuant to C.M.C.R. 235, to correct an illegal sentence and to request resentencing.
Resentencing, however, would not redress the constitutional deprivation at issue here. That deprivation consisted in the fact that the municipal court sentenced Mulkey on the basis of constitutionally defective guilty pleas and an equally unconstitutional judgment of conviction. When no other form of relief is obtainable, legal relief through habeas corpus should always be available to redress an unlawful restraint of one's liberty. See Marshall v. Kort, 690 P.2d 219, 222 (Colo.1984). Since the Colorado Municipal Court Rules did not permit Mulkey to file a postconviction motion to vacate the unconstitutional conviction which resulted in a three and one-half year sentence, Mulkey's only available form of legal redress was a petition for writ of habeas corpus.
Although Mulkey filed his petition for writ of habeas corpus prematurely, in that he was then serving a sentence on a prior conviction, that sentence has since been completed. So far as the record shows, therefore, any additional confinement of Mulkey would be based on the sentence originating from the constitutionally defective guilty pleas and the constitutionally infirm judgment of conviction entered thereon. Relief short of total discharge is available through habeas corpus. Marshall, 690 P.2d at 222. Under the circumstances present here, I believe the appropriate disposition of this case is to affirm that part of the judgment vacating Mulkey's sentence, and to order that the case be remanded to the district court with directions to return the case to the municipal court and order that the municipal court immediately rearraign Mulkey on the municipal ordinance violations in a manner consistent with his constitutional right to counsel and to conduct such further proceedings as necessary.
I am authorized to say that Justice KIRSHBAUM joins me in this special concurrence.
NOTES
[1]  Jurisdiction is properly before this court pursuant to Colo. Const. art. VI, § 2 and C.A.R. 1(a)(1), 7B C.R.S. (1984).
[2]  The eight charges were assault, disorderly conduct, trespass, resisting arrest, two counts of battery, and two counts of malicious injury to property. All the charges arose from one in a series of incidents in which Mulkey attacked his former wife.
[3]  The defendant was charged with both assault and battery against the same victim, his former wife. Under the applicable City of Aurora Ordinance these two charges merged, therefore the defendant was sentenced on seven counts rather than the eight charges originally filed.
[4]  On December 20, 1985, the date of the hearing on the writ of habeas corpus, the defendant was actually serving a 90 day sentence which had been imposed on him on October 31, 1985, after his conviction of a similar charge. Mulkey did not assert that he was being held improperly on the 90 day sentence.
[5]  Specifically, the district court made these findings on the record:

The record is completely devoid of any mention of a formal charge and the Court finds that the record does not support a conclusion that the Defendant pled guilty with an understanding of the nature of the charges.
Rule 211 Subsection 2 requires that the Defendant received a full explanation of his right to trial by jury and his right to counsel. I note there is a difference in the language of Rule 211:Subsection 1 requiring that the Defendant understand the nature of the charge, whereas Subsection 2 only requires that a general explanation be given to the Defendant. I think we will engage in linguistic sophistry if we try to conclude that the Defendant didn't have to understand his right to counsel, but the rule simply required it to be explained. In any event, the Court cannot find from the transcript of the proceeding and testimony that the Defendant's right to counsel was explained fully to him. It was stated that he was asked whether he understood that he was giving up his right to be represented by an attorney. The Defendant indicated, yes, in response to that....
. . . .
Having found then that the Defendant's pleas were not entered in a Constitutional fashion, the Court must find that the sentence imposed has not been done consistent with the Constitution of the laws of Colorado and the Court then finds that the sentence imposed in Case XX-XXXXXXX is, in fact, an illegal sentence and the Defendant may not be held on that sentence.
[6]  The petitioner also asserted that his guilty plea was coerced, and that he was not advised of the possible penalties. Stewart, 157 Colo. at 442, 403 P.2d at 220.
