The opinion of the court was delivered by
McFarland, J.:Ronald Smith appeals from the trial court’s determination that it lacked jurisdiction to hear his second motion to modify the sentences imposed. The Court of Appeals affirmed the trial court’s dismissal of the motion to modify (State v. Smith, 17 Kan. App. 2d 746, 843 P.2d 297 [1992]). The matter is before us on petition for review.
The sole issue presented concerns the extent of the grant of jurisdiction afforded by K.S.A. 1992 Supp. 21-4603(4) to a trial court to modify a sentence. The statute provides:
“(a) Except when an appeal is taken and determined adversely to the defendant as provided in subsection (4)(b), at any time within 120 days after a sentence is imposed, after probation or assignment to a community correctional sei'vices program has been revoked, the court may modify such sentence, revocation of probation or assignment to a community correctional services program by directing that a less severe penalty be imposed in lieu of that originally adjudged within statutory limits and shall modify such sentence if recommended by the Topeka correctional facility unless the court *17finds and sets forth with particularity the reasons for finding that the safety of members of the public will be jeopardized or that the welfare of the inmate will not be served by such modification.
“(b) If an appeal is taken and determined adversely to the defendant, such sentence may be modified within 120 days after the receipt by the clerk of the district court of the mandate from the supreme court or court of appeals.”
The pertinent chronology of events is as follows:
April 23, 1990 Defendant enters his plea of nolo conten-dere to one count each of rape, aggravated criminal sodomy, and aggravated burglary.
May 21, 1990 Defendant is sentenced to a controlling term of 20 to 40 years imprisonment.
May 23, 1990 First motion to modify the sentence is filed.
August 20, 1990 Motion to modify is heard and denied.
August 21, 1990 Appeal from the denial of the motion to modify is filed.
June 14, 1991 Court of Appeals affirms the trial court’s denial of the first motion to modify (unpublished opinion, No. 65,813).
July 15, 1991 Petition for review is filed.
September 18, 1991 Second motion to modify is filed.
November 6, 1991 1. Petition for review is denied.
2. Mandate is issued.
December 12, 1991 Trial court grants the State’s motion to dismiss the second motion to modify for lack of jurisdiction.
December 30, 1991 Notice of appeal is filed from the dismissal of the second motion to modify.
December 18, 1992 Court of Appeals opinion is filed affirming the trial court’s denial of the second motion to modify for lack of jurisdiction.
K.S.A. 1992 Supp. 21-4603 is a lengthy statute dealing generally with what dispositions are authorized in criminal cases. Toward the end of the statute are the provisions at issue granting *18jurisdiction to a trial court to modify the disposition within certain time frames and under certain conditions. It is helpful to think of these provisions as establishing windows of jurisdiction.
The defendant contends the 120-day window under 21-4603(4)(b) opens anytime a mandate issues from an appellate court regardless of what judgment or order was the subject of the appeal. Thus, whether a mandate issues from a direct appeal from a conviction or from an appeal from the denial of any post-trial motion, under defendant’s position, the window opens for a 120-day period. We do not agree.
At this point a discussion of State v. Reed, 253 Kan. 154, 853 P.2d 50 (1993), is appropriate. Reed entered a plea of nolo con-tendere to first-degree murder and was sentenced thereon. He subsequently filed a motion to modify his sentence, and said motion was denied. Later, he filed a motion to withdraw his plea. This motion was denied, and Reed appealed from the denial of this motion. This court affirmed the trial court’s refusal to permit Reed to withdraw his plea (State v. Reed, 248 Kan. 506, 809 P.2d 553 [1991]). After receipt of the mandate, Reed filed a second motion to modify his sentence, which was denied. The State challenged the trial court’s jurisdiction to hear the second motion. We affirmed the trial court’s determination that it had jurisdiction to determine the second motion to modify.
Much of the second Reed opinion is devoted to whether the current version of 21-4603(4) should apply or whether the pre-1988 version was applicable. The pre-1988 version was K.S.A. 1985 Supp. 21-4603(3), which provided:
“Any time within 120 days after a sentence is imposed or within 120 days after probation has been revoked, the court may modify such sentence or revocation of probation by directing that a less severe penalty be imposed in lieu of that originally adjudged within statutory limits. If an appeal is taken and determined adversely to the defendant, such sentence may be modified within 120 days after the receipt by the clerk of the district court of the mandate from the supreme court or the court of appeals.”
The changes between the two versions consist primarily of splitting the two 120-day provisions into separate paragraphs and adding the “Except” clause at the beginning of subsection (a). We concluded the pre-1988 version applied as Reed committed the offense in 1986 and was sentenced in 1987.
*19We further concluded that, under the pre-1988 version of 21-4603:
“[T]he defendant who appeals can file a motion to modify 120 days from sentencing and, if the appeal is determined adversely, 120 days from receipt of the mandate. We conclude that the district court had jurisdiction to consider Reed’s motion to modify sentence following receipt of the mandate even though the court had denied his pre-appeal motion to modify filed within 120 days of sentencing.” 253 Kan. at 162.
There is one very significant factual distinction between Reed and the case before us. Whereas the conviction in each case was on a plea of nolo contendere and each defendant filed an unsuccessful motion to modify within 120 days after his sentence was imposed, the first appeal in Reed was not from the denial of the motion to modify but was from the denial of his motion to withdraw his plea. In his first appeal, Reed was therefore attacking the conviction itself. For our purposes, it was the equivalent of a direct appeal of the conviction. Reed did not appeal from the denial of his first motion to modify.
In the case before us, defendant’s first appeal was not a direct appeal of his conviction, but was an appeal from the denial of his first motion to modify. Defendant is attempting to use the mandate affirming the denial of his first motion to modify to open the jurisdictional window under 21-4603(4)(b) for the filing of a second motion to modify. By this rationale, an unlimited number of motions to modify could be filed as long as each successive motion is filed within the 120-day window after receipt of the mandate affirming the trial court’s denial of a defendant’s most recently filed motion to modify sentence. We believe such a result would be contrary to K.S.A. 1992 Supp. 21-4603(4).
We conclude the “[ejxcept when an appeal is taken and determined adversely to the defendant as provided in subsection (4)(b)” language in (4)(a) means a direct appeal from the conviction. When there is no such appeal, the window granting a trial court jurisdiction to modify the disposition within 120 days after its imposition closes, and, thereafter, the trial court has no jurisdiction to modify the sentence. Exceptions would only exist as to an illegal sentence, which may be corrected at any time (K.S.A. 22-3504[l]), and a statutorily required reconsideration where modification is recommended by the Topeka Correctional Facility.
*20The jurisdictional window under 21-4603(4)(b) only opens upon receipt of a mandate on a direct appeal from the conviction which has been decided adversely to the defendant. Thus, as herein, where there is no direct appeal from the conviction and neither of the aforementioned exceptions are present, the trial court has no jurisdiction to hear a motion to modify filed after the expiration of 120 days from the imposition of the original sentence.
This is a logical construction of the statute. The legislature has granted specific limited jurisdiction to trial courts to modify a disposition in a criminal case. Where there is no legal challenge to the conviction itself, a trial court has, under 21-4603(4)(a), jurisdiction for 120 days to modify the disposition. A defendant may seek sentence modification within that time frame. A defendant appealing his or her conviction is obviously challenging the conviction itself. If successful, there is no need for a defendant to seek modification of the sentence. If the challenge to the conviction is unsuccessful, the legislature grants the trial court jurisdiction for 120 days after receipt of the mandate to modify the sentence imposed on the conviction which has been affirmed. A defendant may, thereby, seek modification of a sentence after the conviction has been affirmed in the appellate process within the statutory time limits.
The judgment of the Court of Appeals is affirmed. The judgment of the district court is affirmed.