
908 S.W.2d 690 (1995)
STATE ex rel. Jeffery OSOWSKI, Petitioner,
v.
James PURKETT, Supt., F.C.C., Respondent.
No. 77918.
Supreme Court of Missouri, En Banc.
November 2, 1995.
Terrence Sexton, Kansas City, for petitioner.
Jeremiah W. (Jay) Nixon, Atty. Gen., Stephen D. Hawke, Asst. Atty. Gen., Jefferson City, for respondent.

ORIGINAL PROCEEDING IN HABEAS CORPUS
PER CURIAM.
On May 21, 1987, Jeffery Osowski pled guilty to the crime of attempted sodomy in violation of § 564.011.1, RSMo.[1] Because § 566.060(4) makes the crime of sodomy a class B felony, attempted sodomy is thus a class C felony under § 564.011.3(2). Osowski was sentenced to fifteen years in prison. However, for a class C felony, the authorized term of imprisonment cannot exceed seven years. § 558.011.1(3).
The body of the information charging Osowski erroneously stated that attempted sodomy was a class B felony. Pursuant to a plea agreement, Osowski pled guilty to attempted sodomy. Relying on the error in the information, the trial judge sentenced Osowski to fifteen years, the maximum sentence for a class B felony under § 558.011.1(2). The record shows on its face that the trial court only had authority to sentence Osowski to a term of imprisonment of seven years. Giving credit for all jail time, *691 Osowski has now served seven years imprisonment. He seeks relief by petition for writ of habeas corpus.
Here the state claims that the defendant has waived any objection as to the propriety of his sentence because he did not raise this issue within the time provided under our rules for filing his post-conviction motions. It may be true that his objections as to the effective representation of his trial counsel are waived; it may also be true that his complaints as to the voluntariness of his guilty plea are waived. However, those waivers do not affect his objection that the sentence exceeds the maximum allowed by law.
If a court imposes a sentence that is in excess of that authorized by law, habeas corpus is a proper remedy. State ex rel. Dutton v. Sevier, 336 Mo. 1236, 83 S.W.2d 581, 582-83 (1935). Dutton suggests that in that circumstance, the proper procedure is to remand the accused to the sheriff of the county where the case was pending for further proceedings upon the criminal charges. In the recent case of Merriweather v. Grandison, 904 S.W.2d 485 (Mo.App.1995), it was also held that the prisoner should be returned to the sentencing court for resentencing within the limits authorized by law. 904 S.W.2d at 489. Neither of the above cases suggests the proper procedure where the defendant has served the maximum sentence authorized by law and, on that basis, are distinguishable. Where habeas corpus is sought because the sentence exceeds the maximum authorized by law and the petitioner waits until he has served the maximum authorized sentence, no purpose is served by remanding the case to the trial court. The judgment will be treated as void to the extent it exceeds the maximum authorized by law, and the defendant discharged.
Petitioner is ordered discharged.
NOTES
[1]  Since petitioner was charged and sentenced under the statute in effect in 1986, all statutory references are to RSMo 1986 unless otherwise noted.
