
215 S.W.3d 776 (2007)
Shaun HOOVER
v.
STATE of Tennessee.
Supreme Court of Tennessee, at Jackson.
November 14, 2006.[1]
January 23, 2007.
*777 Gary F. Antrician, District Public Defender, Somerville, Tennessee, for Appellant, Shaun Hoover.
Paul G. Summers, Attorney General and Reporter; Michael E. Moore, Solicitor General; Gordon W. Smith, Associate Solicitor General; and Seth P. Kestner, Assistant Attorney General, Tennessee, for Appellee, State of Tennessee.
November 14, 2006 Session Heard at Memphis.[1]

OPINION
WILLIAM M. BARKER, C.J., delivered the opinion of the court, in which JANICE M. HOLDER, CORNELIA A. CLARK and GARY R. WADE, JJ., and SHARON G. LEE, SP. J., joined.
We granted permission to appeal in this habeas corpus case to consider the legality of a sentence imposed pursuant to a plea agreement. The agreed sentence exceeds the maximum available term in the offender Range but does not exceed the maximum punishment authorized for the offense. For the reasons explained herein, we conclude that the plea-bargained sentence is legal. Thus, the judgment of the Court of Criminal Appeals dismissing the petition for writ of habeas corpus is affirmed.

I. Background
The petitioner, Shaun Hoover ("Hoover"), was charged with first degree murder and especially aggravated robbery for the 1997 shooting and robbery of Berry Young. Subsequent to his indictment, Hoover negotiated a plea agreement with the State. In exchange for Hoover pleading guilty to the lesser-included offenses of second degree murder and attempt to commit especially aggravated robbery, the State agreed that Hoover should be classified as a Range I, standard offender and that he should receive concurrent sentences of thirty-five years with a release eligibility of 100 percent for second degree murder and twelve years with a release eligibility of thirty percent for attempt to commit especially aggravated robbery. On November 29, 1999, the Shelby County Criminal Court entered a judgment in accordance with the plea agreement.[2]
Almost six years later, on March 3, 2005, Hoover filed a habeas corpus petition challenging the legality of the thirty-five-year sentence he received for second degree murder. Hoover argued that the sentence is illegal because it exceeds the maximum twenty-five-year sentence statutorily authorized for a Range I offender convicted *778 of second degree murder. See Tenn.Code Ann. § 40-35-112(a)(1) (2006). The trial court granted Hoover habeas corpus relief, stating "the thirty-five[-]year sentence for second degree murder . . . is for [a] term in excess of the provisions of the 1989 Act."
The State appealed, and the Court of Criminal Appeals reversed the trial court's judgment, holding that Hoover's thirty-five-year sentence is legal because it does not exceed the maximum sixty-year sentence available for Class A felonies such as second degree murder. See Tenn.Code Ann. § 39-13-210(c) (2006); Tenn.Code Ann. § 40-35-111(a), (b)(1) (2006). We granted Hoover's application for permission to appeal to consider the legality of the guilty plea and to clarify any confusion stemming from our decision in McConnell v. State, 12 S.W.3d 795 (Tenn.2000). For the reasons herein explained, we affirm the judgment of the Court of Criminal Appeals.

II. Analysis
The right to seek habeas corpus relief is guaranteed by article I, section 15 of the Tennessee Constitution, which provides that "the privilege of the writ of Habeas Corpus shall not be suspended, unless when in case of rebellion or invasion, the General Assembly shall declare the public safety requires it." However, the grounds upon which habeas corpus relief will be granted are narrow. Hickman v. State, 153 S.W.3d 16, 20 (Tenn. 2004). A petitioner is entitled to habeas corpus relief only if the petition establishes that the challenged judgment is void, rather than merely voidable. Id.; Taylor v. State, 995 S.W.2d 78, 83 (Tenn. 1999). A judgment is void "only when `it appears upon the face of the judgment or the record of the proceedings upon which the judgment is rendered' that a convicting court was without jurisdiction or authority to sentence a defendant, or that a defendant's sentence of imprisonment or other restraint has expired." Archer v. State, 851 S.W.2d 157, 164 (Tenn.1993) (quoting State v. Galloway, 45 Tenn. (5 Cold.) 326, 336-37 (Tenn.1868)); see also State v. Ritchie, 20 S.W.3d 624, 630 (Tenn. 2000). A sentence imposed in direct contravention of a statute is void and illegal and subject to attack in a habeas corpus proceeding. Smith v. Lewis, 202 S.W.3d 124, 127 (Tenn.2006); Stephenson v. Carlton, 28 S.W.3d 910, 911 (Tenn.2000).[3] In this appeal, Hoover claims that the judgment entered against him is void because it includes an illegal sentence. Whether habeas corpus relief should be granted is a question of law to which we apply de novo review and afford no presumption of correctness to the lower court's judgment. Hogan v. Mills, 168 S.W.3d 753, 755 (Tenn.2005).
Before considering the merits of Hoover's claim, we must address the State's argument that Hoover's challenge to the legality of his thirty-five-year sentence is premature. The State avers that the challenge is premature because Hoover would remain in custody on the twelve-year concurrent sentence for attempt to commit especially aggravated robbery even if he receives habeas corpus relief on the thirty-five-year sentence for second degree murder. In addition, the State posits that Hoover may not challenge the validity of his thirty-five-year sentence until he serves "an uncontestedly valid sentence" of *779 twenty-five years. We reject the State's arguments. As we recently explained, when a sentence is illegal and void, the illegality inheres upon entry of the judgment imposing the sentence. Smith, 202 S.W.3d at 128. The illegality does not "spring into being" at some future point in time. Id. Thus, the State's arguments that Hoover's habeas corpus claim is premature are without merit. Having addressed this threshold issue, we turn to Hoover's assertion that his thirty-five-year sentence is illegal.
Second degree murder is a Class A felony. Tenn.Code Ann. § 39-13-210(b) (2003). The statutorily authorized punishment for Class A felonies is a determinate sentence of not less than fifteen years nor more than sixty years. Tenn.Code Ann. § 40-35-111(a), (b)(1) (2006). A Range I offender convicted of a Class A felony may receive a sentence of not less than fifteen nor more than twenty-five years. Tenn. Code Ann. § 40-35-112(a)(1) (2006). While Hoover's plea-bargained thirty-five-year sentence is outside the parameters of Range I offenders, the plea-bargained sentence is well within the overall punishment range authorized for Class A felony offenses, such as second degree murder. A review of this Court's decisions establishes that it is this latter rangethe overall punishment range authorized for the plea offensethat controls the determination of whether an agreed sentence is legal.
In State v. Mahler, 735 S.W.2d 226 (Tenn.1987), a decision under the Criminal Sentencing Reform Act of 1982 ("1982 Act"), the petitioner, indicted for first degree murder, negotiated a plea bargain by which he agreed to plead guilty to second degree murder in exchange for the State's recommendation of a fifty-year sentence as a Range II offender. 735 S.W.2d at 227. Mahler agreed to the Range II offender classification and sentence despite the fact that his prior criminal record was not sufficient to qualify him as a Range II offender. Id. We denied Mahler's post-conviction challenge to the legality of his plea-bargained sentence. Id. Noting that the overall statutory range of punishment for the offense of second degree murder under the 1982 Act was ten years to life, we held:
The sentence imposed was clearly within statutory limits fixed for the offense of murder in the second degree. In our opinion any question as to the classification of appellant as a Range II offender or as to his release eligibility was waived by the guilty plea. It was not a constitutional error in and of itself and at most rendered the sentence subject to attack on direct review by appeal. Appellant waived any right of appeal in the guilty plea proceedings, and expressly agreed to be sentenced with the classification and parole eligibility imposed.
Id. at 228. We emphasized that the plea agreement in Mahler differed from "other cases where sentences were imposed which were higher or lower than that authorized by the statute designating the punishment for the crime" and noted that the sentences in "those [other] cases" were "subject to being later vacated or corrected." Id. (citing State v. Hamlin, 655 S.W.2d 200, 201 (Tenn.Crim.App.1983)).
Ten years later, in Hicks v. State, 945 S.W.2d 706 (Tenn.1997), a case arising under the 1989 Act, we considered "whether a plea[-]bargained Range II sentence is valid when coupled with Range I release eligibility." Id. at 706. Hicks, who had received a Range II sentence of ten years for voluntary manslaughter coupled with a thirty percent Range I release eligibility, mounted a post-conviction challenge to the legality of the agreed sentence. Id. In rejecting this challenge, we discussed Mahler and two intermediate appellate court decisions that had applied Mahler: *780 State v. Terry, 755 S.W.2d 854 (Tenn.Crim. App.1988), and Gentry v. State, No. 02C01-9304-CC-00052, 1994 WL 284115 (Tenn.Crim.App. June 29, 1994), perm. to appeal denied, (Tenn. Oct. 3, 1994). Hicks, 945 S.W.2d at 707-09. In our discussion of these cases, we emphasized and re-affirmed two propositions. First, a plea-bargained sentence is legal so long as it does not exceed the maximum punishment authorized for the plea offense. Id. at 707. Second, a knowing and voluntary guilty plea waives any irregularity as to offender classification or release eligibility. Id. at 709. We observed that the General Assembly evinced its intent to permit the practice approved in Mahler when it failed in the 1989 Act to limit the use of offender classification and release eligibility as plea bargaining tools. Id.
Three years after Hicks, we decided McConnell v. State, 12 S.W.3d 795 (Tenn. 2000). Like Hoover, McConnell had been charged with first degree murder, and he pleaded guilty to second degree murder and received a plea-bargained sentence of thirty-five years. McConnell, 12 S.W.3d at 796. The plea agreement in McConnell was erroneously structured pursuant to the 1982 Act. Id. However, the 1989 Act applied at the time McConnell committed the offenses. Id. at 797. We granted McConnell post-conviction relief. Id. at 800. Hoover now asserts that McConnell is controlling law and that it entitles him to habeas corpus relief.
Admittedly, McConnell's explanation of the rationale supporting the decision to grant post-conviction relief is not a model of clarity. Indeed, Hoover is correct that language in McConnell suggests that relief was granted because the plea-bargained sentence exceeded the maximum sentence authorized by the 1989 Act for a Range I offender convicted of second degree murder. See McConnell, 12 S.W.3d at 800 ("We conclude that thirty-five-year sentences for a Range I offender for second degree murder and robbery by use of a deadly weapon are not permitted by the 1989 Act.") However, as the State points out, a contextual reading of the entire opinion reveals that McConnell did not repudiate the rule announced in Mahler and subsequently re-affirmed in Hicks. Indeed Hicks and Mahler were cited with approval in McConnell. McConnell, 12 S.W.3d at 798. Furthermore, McConnell itself declared that it "in no way" altered "the ability of the State and defendants to use offender classification and release eligibility as subjects of plea bargain negotiations." Id. As the Court of Criminal Appeals has correctly concluded, post-conviction relief was granted in McConnell because the plea agreement was structured pursuant to a wholly inapplicable statute, not because the agreed sentence exceeded that available for the offender classification. See, e.g., Bland v. Dukes, 97 S.W.3d 133, 135 (Tenn.Crim.App.2002), perm. to appeal denied, (Tenn.2002).
Thus clarified, McConnell does not entitle Hoover to habeas corpus relief. A plea-bargained sentence may legally exceed the maximum available in the offender Range so long as the sentence does not exceed the maximum punishment authorized for the plea offense. Hoover's plea-bargained sentence is well below the maximum punishment authorized for the Class A felony offense of second degree murder. We reiterate that offender classification and release eligibility are non-jurisdictional and may be used as bargaining tools by the State and the defense in plea negotiations.[4] Hoover waived any irregularity *781 concerning his offender classification or release eligibility when he pleaded guilty. Thus, Hoover is not entitled to habeas corpus relief.

III. Conclusion
For the reasons stated herein, we reject Hoover's argument that McConnell entitles him to habeas corpus relief. We clarify that post-conviction relief was granted in McConnell because the plea agreement was structured pursuant to an inapplicable statute. Consistent with State v. Mahler, 735 S.W.2d 226 (Tenn.1987), and Hicks v. State, 945 S.W.2d 706 (Tenn.1997), we hold that a plea-bargained sentence is legal so long as it does not exceed the maximum punishment authorized for the plea offense. Because Hoover's plea-bargained sentence is well below the maximum punishment authorized for the plea offense of second degree murder, the agreed sentence is legal. Thus, Hoover is not entitled to habeas corpus relief. The judgment of the Court of Criminal Appeals dismissing the petition for writ of habeas corpus is affirmed.
It appearing that the defendant is indigent, costs of this appeal shall be paid by the State of Tennessee, for which execution may issue if necessary.
NOTES
[1]  Oral argument in this case was presented November 14, 2006, in Memphis, Shelby County, Tennessee, as part of this Court's S.C.A.L.E.S. (Supreme Court Advancing Legal Education for Students) project.
[2]  The plea agreement was negotiated and structured pursuant to the provisions of the 1989 Criminal Sentencing Reform Act ("1989 Act"). Because the relevant statutory language has not changed since the judgment was entered in 1999, statutory citations in this opinion are to the current version of the Tennessee Code Annotated.
[3]  A void or illegal sentence also may be challenged in a timely filed post-conviction petition. See, e.g., State v. Mahler, 735 S.W.2d 226, 228 (Tenn.1987); see also Tenn.Code Ann. § 40-30-102(a) (2006) (providing a one-year statute of limitations for the filing of post-conviction petitions).
[4]  We caution, however, that the State may not confer through plea negotiations release eligibility for criminal offenses that are statutorily ineligible for early release. See, e.g., Smith v.
