
123 Ill.2d 291 (1988)
527 N.E.2d 307
KAREEM FAHEEM-EL, Petitioner,
v.
PAUL KLINCAR, Chairman, Prisoner Review Board, et al., Respondents.
No. 66199.
Supreme Court of Illinois.
Opinion filed July 20, 1988.
*292 *293 Thomas J. Bamonte, of Sachnoff, Weaver & Rubenstein, Ltd., of Chicago, for petitioner.
Neil F. Hartigan, Attorney General, of Springfield (Shawn W. Denney, Solicitor General, and Terence Madsen and Nathan P. Maddox, Assistant Attorneys General, of counsel), for respondents.
Writ denied.
CHIEF JUSTICE MORAN delivered the opinion of the court:
Petitioner, Kareem Faheem-El, also known as Lawrence Griffin, filed in this court an original petition for a writ of habeas corpus seeking his release from the Cook County jail. The petition is directed against the chairman of the Prisoner Review Board, the Director of Corrections and the sheriff of Cook County (collectively, respondents). Petitioner contends that his current imprisonment pursuant to a parole revocation order of the Prisoner Review Board (Board) is unlawful and that a writ of habeas corpus should issue for his discharge from custody.
This case presents the question whether the length of parole for those prisoners sentenced between January 1, 1973, and February 1, 1978, is strictly limited to the length of the "parole term" as set forth in section 5-8-1(d) (Ill. Rev. Stat. 1979, ch. 38, par. 1005-8-1(d)) of the Unified Code of Corrections (Code of Corrections) (Ill. Rev. Stat. 1973, ch. 38, par. 1001 et seq.).
*294 The relevant facts set forth in the petition for a writ of habeas corpus are admitted by respondents. In 1973, petitioner was convicted of murder and sentenced to an indeterminate term of 30 to 90 years' imprisonment. Ten years later, on October 5, 1983, petitioner was paroled from the Stateville Correctional Center.
On January 23, 1984, petitioner was arrested and charged with a parole violation. However, the underlying criminal charges were dropped and at the final parole revocation hearing on February 5, 1985, petitioner was continued on parole.
On April 5, 1987, approximately 3 1/2 years after first being paroled, petitioner was arrested and charged with delivering $30 worth of cocaine. A judge found petitioner eligible for bail. Petitioner claims he was, and has been, ready, willing and able to post the $1,500 cash bond necessary to secure his release.
Petitioner's release was prevented, however, when respondents issued a parole violator warrant against petitioner soon after his arrest. On October 9, 1987, the Board held a final parole revocation hearing. The Board found that plaintiff had violated a condition of his parole on April 5, 1987, and ordered him incarcerated as a parole violator. Petitioner is currently imprisoned in the Cook County jail pursuant to the Board's parole revocation order.
This court is authorized by the 1970 Illinois Constitution to exercise original jurisdiction in cases relating to habeas corpus (Ill. Const. 1970, art. VI, § 4(a)). (See also 107 Ill.2d R. 381; Hughes v. Kiley (1977), 67 Ill.2d 261, 266.) Habeas corpus provides relief only on the grounds specified in section 10-124 of the Code of Civil Procedure (Ill. Rev. Stat. 1985, ch. 110, par. 10-124). (People v. Warr (1973), 54 Ill.2d 487, 491 (construing the predecessor of section 10-124 (Ill. Rev. Stat. 1971, ch. 65, par. 22)).) Section 10-124 provides, among other things, *295 that, if it appears that the prisoner is in custody by virtue of process from any court legally constituted, he may be discharged even though the original imprisonment was lawful when "by some act, omission or event which has subsequently taken place, the party has become entitled to his discharge" (Ill. Rev. Stat. 1985, ch. 110, par. 10-124(2)). Under this provision, a prisoner who has satisfied the judgment under which he is confined may invoke the writ of habeas corpus to obtain his release from imprisonment. (People ex rel. Titzel v. Hill (1931), 344 Ill. 246, 251.) On the other hand, habeas corpus does not lie if the person is in custody by virtue of a final judgment of any circuit court, or of any proceeding for the enforcement of such judgment, unless the time during which such party may be legally detained has expired. (Ill. Rev. Stat. 1985, ch. 110, par. 10-123.) Therefore, in this case, only if petitioner may no longer be legally detained under the sentence of imprisonment imposed against him in 1973 should a writ of habeas corpus issue for his discharge from custody.
Petitioner was paroled on October 5, 1983, after serving 10 years of a 30- to 90-year term of imprisonment. Section 3-3-8 provides that "[t]he length of parole * * * is set out in Section 5-8-1 unless parole is sooner terminated." (Ill. Rev. Stat. 1973, ch. 38, par. 1003-3-8.) Section 5-8-1 in turn dictates the sentence of imprisonment for a felony and provides in relevant part:
"(a) A sentence of imprisonment for a felony shall be an indeterminate sentence set by the court under this Section.
(b) The maximum term shall be set according to the following limitations:
(1) for murder, the maximum term shall be any term in excess of 14 years;

*296 *   *   *
(c) The minimum term shall be set according to the following limitations:
(1) for murder, the minimum term shall be 14 years unless the court, having regard to the nature and circumstances of the offense and the history and character of the defendant, sets a higher minimum term.
*   *   *
(e) Every indeterminate sentence shall include as though written therein a parole term in addition to the term of imprisonment. Subject to earlier termination under section 3-3-8, the parole term shall be as follows:
(1) for murder * * *, 5 years." (Ill. Rev. Stat. 1973, ch. 38, par. 1005-8-1.)
In 1978, the legislature amended, among other things, subsection (e) (which became subsection (d)) and reduced the parole term for murder from five years to three years. (Ill. Rev. Stat. 1979, ch. 38, par. 1005-8-1(d).) The legislature expressed a clear intent to apply the reduced parole term to those prisoners sentenced prior to, but paroled after, the effective date of the amendment. ("For those sentenced under the law in effect prior to this amendatory Act of 1977," the parole term shall be three years. (Ill. Rev. Stat. 1979, ch. 38, par. 1005-8-1(d)).) (All references to section 5-8-1(d) herein are to the 1978 amendment as applied retroactively to petitioner; the applicable law is otherwise that in effect at the time of sentence.) Such a retroactive application of conditions of parole is valid. (People ex rel. Weaver v. Longo (1974), 57 Ill.2d 67, 72.) Therefore, petitioner's indeterminate sentence includes as though written therein a "parole term" of three years in addition to his term of imprisonment.
Petitioner asserts that his parole term began when he was paroled on October 5, 1983, and that under section 5-8-1(d), it ended three years later on October 5, 1986. According to petitioner, the legislature has expressly limited *297 the Board's parole revocation powers to the duration of the three-year parole term. Petitioner contends that once he completed his parole term on October 5, 1986, he was no longer in respondent's custody and consequently respondents had no authority to revoke his parole after he was arrested on April 5, 1987. He concludes that his current imprisonment is unlawful and that he should be free on bail pending trial on the new cocaine charge.
Respondents answer that the three-year parole term in section 5-8-1(d) does not begin to run until expiration of the maximum term to which the prisoner was sentenced. According to respondents, the language of section 5-8-1(d) indicates that petitioner is subject to the parole term in addition to the maximum term of imprisonment. Historically, respondents point out, parole has been simply an alternative method by which a prisoner serves his sentence, and consequently admission to parole does not entitle a prisoner to discharge. Instead, a parolee, although not confined in prison, remains at all times in the custody of the Department of Corrections until expiration of the sentence. The mandatory parole term under section 5-8-1(d), on the other hand, is distinct from that of parole as an alternative to imprisonment and, according to respondents, was intended by the legislature to enhance, not reduce, the control of the Department over prisoners, especially those prisoners who repeatedly are denied parole and serve the maximum term of imprisonment. Respondents conclude that petitioner remains in the custody of the Department for the maximum term of imprisonment and, in addition, the parole term of section 5-8-1(d). Consequently, under respondents' construction of the statute, petitioner's parole was subject to revocation on April 7, 1987.
In construing statutory provisions, it is axiomatic that the court must ascertain and give effect to the legislative *298 intent. (Page v. Hibbard (1987), 119 Ill.2d 41, 46.) Although penal statutes are to be strictly construed in favor of the accused, they must not be so rigidly construed as to defeat the intent of the legislature. (People v. Haywood (1987), 118 Ill.2d 263, 271.) In construing statutory provisions, the court should consider not only the language of the statute but also the reason and necessity for the law, the evils to be remedied, and the objects and purposes to be attained. 118 Ill.2d 263.
Section 3-3-8 of the Code of Corrections provides that the "length of parole" is "set out in Section 5-8-1." (Ill. Rev. Stat. 1973, ch. 38, par. 1003-3-8.) We find special significance in the citation to section 5-8-1 as a whole rather than only to subsection 5-8-1(d). Section 5-8-1 as a whole not only provides for a mandatory parole term but also establishes the minimum and maximum terms of imprisonment for a particular offense. Therefore, the "length of parole" that is "set out in section 5-8-1" includes any remaining period of the maximum term of imprisonment and, in addition, the mandatory parole term. In other words, the term of parole under section 5-8-1(d) is not the only term of parole a prisoner may serve. A prisoner may be allowed by the Board to serve an additional discretionary term of parole as an alternative to imprisonment.
Our conclusion is supported by the language of section 5-8-1(d) itself. Section 5-8-1(d) provides that "[e]very sentence shall include as though written therein a [parole] term in addition to the term of imprisonment." (Emphasis added.) (Ill. Rev. Stat. 1979, ch. 38, par. 1005-8-1(d).) The legislature's use of the phrase "in addition to" dictates that the separate mandatory parole term in section 5-8-1(d) cannot be served during the term of imprisonment. The "term of imprisonment" is the sentence of imprisonment imposed by the court. (Ill. Rev. Stat. 1973, ch. 38, par. 1005-5-3(d)(3) *299 ("the court may sentence such defendant to: * * * a term of imprisonment").) That is, the term of imprisonment is the amount of time a prisoner is subject to serve, not the amount of time actually spent imprisoned before parole. Consequently, the mandatory parole term in section 5-8-1(d) cannot begin to run until after the maximum term of imprisonment is satisfied, either by actual incarceration or by discretionary parole.
Indeed, such a conclusion is mandated by the definition and legal effect of parole. "Parole" is defined as "the conditional and revocable release of a committed person under the supervision of a parole officer." (Ill. Rev. Stat. 1973, ch. 38, par. XXXX-X-XX.) That definition does not include within it the concept of early discharge of sentence. Moreover, in People v. Williams (1977), 66 Ill.2d 179, cited by neither party, this court held that under the Unified Code of Corrections,
"in a legal sense, parole does not diminish a judicially imposed sentence or in any way affect it. [Citations.] A person on parole remains subject to the sentence of commitment to the Department of Corrections for the period of time specified by the court. Parole alters only the method and degree of confinement during the period of commitment." (Emphasis added.) (Williams, 66 Ill.2d at 187.)
Therefore, admission to parole by itself cannot entitle a prisoner to his discharge.
Keeping in mind the legal effect of parole, the parole scheme established by the Code becomes clear. Prisoners such as petitioner are eligible for parole when they have served the minimum term of an indeterminate sentence less time credit for good behavior, or 20 years less time credit for good behavior, whichever is less. (Ill. Rev. Stat. 1973, ch. 38, par. 1003-3-3.) Consequently, the period of time remaining on the maximum term of imprisonment for most prisoners who are paroled soon after they first become eligible will almost always be much *300 longer than the mandatory term of parole under section 5-8-1(d). Petitioner, for example, had 80 years remaining on his maximum term of imprisonment when he was first paroled, while the mandatory parole term was only 3 years. Therefore, given the limited legal effect of parole, serving parole for the period of time mentioned in section 5-8-1(d) cannot act to discharge the prisoner unless by doing so he has also fully satisfied his sentence of commitment to the Department of Corrections. That is not possible unless the mandatory parole term under section 5-8-1(d) only begins to run upon expiration of the maximum term to which the prisoner was sentenced.
Moreover, we find our construction of the statute consistent with the purpose and necessity for the mandatory parole term. Prior to enactment of the Code of Corrections, Illinois law did not impose a specific parole term for a given offense. The statutes governing parole set forth when an inmate would be eligible for release or parole (Ill. Rev. Stat. 1971, ch. 38, par. 123-2), the terms governing revocation of parole (Ill. Rev. Stat. 1971, ch. 38, par. 123-3), and the procedure for discharge from parole (Ill. Rev. Stat. 1971, ch. 38, par. 123-4). Unless discharged, a parolee remained in the custody of the State until the expiration of the maximum term of his sentence of imprisonment. (People ex rel. Johnson v. Pate (1970), 47 Ill.2d 172, 174.) However, no person could be continued on parole or imprisoned beyond the maximum term provided by law for the offense of which he was convicted. Ill. Rev. Stat. 1971, ch. 38, par. 123-4.
Under the statutory scheme in effect prior to 1973, an inmate who failed to earn any good-time credits in prison and who consequently was incarcerated for his entire maximum sentence would be released into society with no possibility of continuing control by the Department of Corrections. Thus, those individuals who had *301 been most disruptive while in prison and who were most likely to have difficulty reintegrating themselves into society could not be legally supervised during this crucial period of reintegration.
The Code of Corrections, adopted by Public Act 77-2097, effective January 1, 1973, responded to that problem, among others, by automatically including within the sentence a requirement that a prisoner serve a period of parole whether or not he or she has served the maximum term of imprisonment. (Ill. Rev. Stat. 1979, ch. 38, par. 1005-8-1(d).) This additional period of parole was thus created in large part to extend the Department's control over the conduct of persons who repeatedly are denied parole and who when released have only minimal incentives to conform to society's standards. The legislature enacted section 5-8-1(d) to assure that all prisoners, including those who repeatedly fail to merit parole, will be subject to parole for a substantial period after release from imprisonment.
Based upon this historical evolution of the statutes governing parole, we find that the purpose of the adoption of mandatory periods of parole in section 5-8-1(d) was solely to enhance, not reduce, the Department's control over an inmate and parolee. We find nothing in the language of the statute or its purpose to suggest that the legislature intended section 5-8-1(d) to reduce the sentence imposed by a court or to allow for early discharge of sentence or in any way to lessen the control of the Department over an inmate or parolee.
Indeed, to adopt petitioner's construction of the Code of Corrections would lead to absurd results. According to petitioner, if he had violated a condition of parole on October 5, 1986, his parole would have been subject to revocation. If the same event occurred on October 6, 1986, his parole could not, according to petitioner, be revoked because he was discharged from his sentence the *302 day before. Under the first scenario, petitioner could have been reconfined for the remaining imposed maximum term of imprisonment and the mandatory parole term (Ill. Rev. Stat. 1973, ch. 38, par. 1003-3-9), that is, until the year 2066 (not considering good-conduct credits). Under the latter scenario, by the mere passage of 24 hours, petitioner could avoid several decades of imprisonment and would not be subject to reconfinement at all. That is a patently absurd result. The mandatory parole term under section 5-8-1(d) was not intended to act as a test of fire or a gauntlet towards liberty. We are obliged to construe statutes to avoid absurd or unjust consequences. (People v. Williams (1987), 119 Ill.2d 24, 28.) We decline to accept the construction of the Code of Corrections offered by petitioner.
In conclusion, without considering the effect of good-conduct credits which are not at issue in this case, petitioner is subject to the custody of the Department of Corrections  either in prison or on parole  for the remainder of his maximum term of imprisonment and, in addition, the three-year mandatory parole term under section 5-8-1(d) of the Code of Corrections. (Ill. Rev. Stat. 1973, ch. 38, par. XXXX-XX-X(a) ("The Department shall retain custody of all persons placed on parole * * * and shall supervise such persons during their parole * * * period").) The time during which petitioner may be legally detained under the judgment against him in 1973 has not yet expired. The completion of three years of parole by petitioner does not constitute an act, omission or event by which he has become entitled to be discharged. Petitioner has thus failed to establish a cause for discharge under section 10-124 of the Code of Civil Procedure (Ill. Rev. Stat. 1985, ch. 110, par. 10-124). For the reasons set forth above, the petition for a writ of habeas corpus is denied.
Writ denied.
