
263 Kan. 185 (1997)
946 P.2d 1369
STATE OF KANSAS, Appellant/cross-appellee,
v.
DANIEL LEE UNRUH, Appellee/cross-appellant.
No. 77,640.
Supreme Court of Kansas.
Opinion filed October 31, 1997.
*186 Ty Kaufman, county attorney, argued the cause and Carla J. Stovall, attorney general, was with him on the brief for appellant/cross-appellee.
David P. Simmons, of Woodbury, Minnesota, argued the cause and was on the brief for appellee/cross-appellant.
The opinion of the court was delivered by
DAVIS, J.:
This is an appeal by the State on a question reserved. The State raises the same issues it attempted to resolve by an interlocutory appeal, which we dismissed earlier for lack of jurisdiction. State v. Unruh, 259 Kan. 822, 915 P.2d 744 (1996) (Unruh I). We again dismiss the appeal on the State's question reserved. The defendant cross-appeals, claiming that the delay caused by the interlocutory appeal violated his right to a speedy trial under K.S.A. 22-3402(1). We agree and reverse and remand for discharge of the defendant.
This case has a long history. It is helpful to recount the facts giving rise to the State's interlocutory appeal:
"The defendant [Daniel Lee Unruh] was originally charged with one count of possession of methamphetamine under K.S.A. 1993 Supp. 65-4127a. Normally, possession would be a severity level 4 felony, but the defendant was charged with a severity level 1 felony offense based upon his two prior convictions in 1988 under the provisions of K.S.A. 1988 Supp. 65-4127b for sale of methamphetamine. See K.S.A. 1993 Supp. 65-4127a(c). The defendant was also charged with one count of unlawful possession of drug paraphernalia.
"The defendant entered into a plea agreement with the State whereby he agreed to enter a plea of nolo contendere to the felony charge of possession in exchange for the State's agreeing to (1) dismiss the drug paraphernalia charge and (2) amend the possession of methamphetamine charge to possession of methamphetamine, having once been convicted under the Uniform Controlled Substances Act for sale of methamphetamine. The second provision of the plea agreement had the effect of reducing his crime of possession of methamphetamine from a severity level 1 felony to a severity level 2 felony. See K.S.A. 1993 Supp. 65-4127a(c). Pursuant to the agreement, the defendant pled no contest to the amended charge, and the court, satisfied that a factual basis existed, accepted his plea and found him guilty.
"Prior to sentencing, the defendant filed a motion captioned `Objections to Criminal History Classification and Severity Level.' He argued that his prior 1988 convictions for sale of methamphetamine could not be used to enhance his current offense. The defendant's argument is based upon K.S.A. 1993 Supp. 65-4127a:
`(c) If any person has a prior conviction under this section or a conviction for a substantially similar offense from another jurisdiction, then that person *187 shall be guilty of a drug severity level 2 felony and if the person who violates this section has two or more prior convictions under this section or substantially similar offenses under the laws of another jurisdiction, then such person shall be guilty of a drug severity level 1 felony.' (Emphasis added.) "The defendant argued that his two prior convictions for possession of methamphetamine occurred in 1988 under the provisions of K.S.A. 1988 Supp. 65-4127b rather than under K.S.A. 1988 Supp. 65-4127a; therefore, they were not under this section as provided for under K.S.A. 1993 Supp. 65-4127a(c) and could not be used to make his most recent conviction a severity level 2 felony.
"At the hearing on his motion, the defendant did not ask the court to vacate the plea agreement but instead asked that his current conviction be properly counted as a drug severity level 4 offense and that his prior convictions be used to determine the appropriate criminal history category of F. In the alternative, the defendant asked that if the court held the current conviction to be a drug severity level 2 offense, that his prior criminal history should not include either prior conviction because under K.S.A. 1993 Supp. 21-4712 they would be elements of or used to enhance the severity level of the current criminal conviction. The State argued that the defendant had already pled no contest and should not now be allowed to unilaterally rewrite the plea bargain.
"After taking the issue under advisement, the court held that the defendant's conviction for sale of methamphetamine under a previous statute did not constitute a prior conviction under K.S.A. 1993 Supp. 65-4127a(c) because the conviction was not under this section as set forth in K.S.A. 1993 Supp. 65-4127a(c). The court vacated the defendant's plea, finding that the factual statement supporting the plea was incorrect and that his plea of nolo contendere should not have been accepted. The court found that neither party was bound by the plea agreement." Unruh, 259 Kan. at 822-24.
The State attempted to appeal the above decision along with the issues involving enhancement of the defendant's sentence. Because the State did not satisfy any of the statutory grounds authorizing an appeal to this court, we dismissed for lack of jurisdiction. Upon this court's dismissal of the appeal, the district court accepted the defendant's plea of not guilty to the original charges and set the case for jury trial. The defendant moved to dismiss on the basis that his right to a speedy trial under the provisions of K.S.A. 22-3402(1) had been violated. He argued that the time delay for the State's attempted interlocutory appeal was attributable to the State, thereby denying him his statutory right to a speedy trial. The district court denied his motion and the matter was tried.
A jury found the defendant guilty on both counts of the original complaint. At sentencing, the district court was again required to *188 decide whether K.S.A. 1993 Supp. 65-4127a allowed the enhancement of the severity level of the offense based on the defendant's two prior convictions under K.S.A. 1988 Supp. 65-4127b. See K.S.A. 1993 Supp. 65-4127a(c). Consistent with its earlier ruling, the district court determined that the prior convictions did not enhance the severity level and, therefore, the prior convictions were included in the defendant's criminal history for sentencing purposes. The court imposed consecutive sentences of 18 months and 6 months for counts one and two, respectively.
The district court had vacated the defendant's plea on April 11, 1995. The State had filed its interlocutory appeal on April 19, 1995. The defendant was brought to trial on June 26, 1996. The total delay from the vacating of the plea until the defendant was tried on the charges was 440 days. During this entire time, the defendant was held in the county jail solely on the charges involved.
Before addressing the defendant's contention that he was denied a speedy trial, we pause briefly to discuss an important matter not addressed by either party or the district court. The plea agreement in this case was not one authorized by law. The provisions of K.S.A. 21-4713 set forth actions which prosecutors may take under agreements with defendants for plea, including exceptions relating to prior convictions. K.S.A. 21-4713(f) provides that the prosecutor may:
"make any other promise to the defendant, except that the prosecutor shall not enter into any agreement to decline to use a prior drug conviction of the defendant to elevate or enhance the severity level of a drug crime as provided in K.S.A. 65-4127a, 65-4127b and 65-4159 or K.S.A 1995 Supp. 65-4160 through 65-4164 and amendments thereto, or make any agreement to exclude any prior conviction from the criminal history of the defendant." (Emphasis added.)
The original complaint in this case charged the defendant with possession of methamphetamine "having twice previously been convicted under the Uniform Controlled Substances Act for sale of methamphetamine ... contrary to K.S.A. 65-4127a, a drug severity level 1 Felony." In its plea negotiations, the State agreed "to decline to use a prior drug conviction of the defendant to elevate or enhance the severity level of a drug crime as provided in K.S.A. 65-4127a [or] 65-4127b." K.S.A. 21-4713(f). The amended *189 complaint charged the defendant with possession of methamphetamine, having once been convicted under the Uniform Controlled Substances Act for sale of methamphetamine, a severity level 2 felony. This is not allowed by law.
The trial court set aside the plea agreement on the basis that the prior 1988 convictions for sale of methamphetamine under K.S.A. 1988 Supp. 65-4127b, since they were not under "this section" as used in K.S.A. 1993 Supp. 65-4127a, could not be used to enhance the severity level of the present offense. While the reason advanced by the trial court is questionable, see State v. Crank, 262 Kan. 449, 939 P.2d 890 (1997), the trial court reached the right result in setting aside a plea agreement not authorized by law. See State v. Donlay, 253 Kan. 132, 134, 853 P.2d 680 (1993) (holding that the judgment of the trial court, if correct, is to be upheld even though the court may have relied upon a wrong ground or assigned an erroneous reason for its decision).
We now turn to the defendant's argument that the State's attempted interlocutory appeal was unauthorized and resulted in a violation of the defendant's statutory right to a speedy trial under the provisions of K.S.A. 22-3402(1). We note that the defendant in this case was held in the county jail solely on the crime charged, including the 440 days in which the State attempted to take an interlocutory appeal. While K.S.A. 22-3604 generally provides that a defendant shall not be held in jail or subject to an appearance bond during the pendency of an appeal by the prosecution, the defendant in this case was held in the county jail based upon one of the exceptions provided for in K.S.A. 22-3604(3), viz., the defendant was charged with a "drug severity level 1 through 3 felony" crime.
"The State's right to appeal in a criminal case is strictly statutory. Appellate courts have jurisdiction to entertain an appeal only if it is taken within time limitations and in the manner prescribed by the applicable statutes." State v. Kleen, 257 Kan. 911, Syl. ¶ 1, 896 P.2d 376 (1995). K.S.A. 22-3602(b) sets out appeals which may be taken to this court by the prosecution as a matter of right:
"(b) Appeals to the supreme court may be taken by the prosecution from cases before a district judge as a matter of right in the following cases, and no others:

*190 (1) From an order dismissing a complaint, information or indictment;
(2) from an order arresting judgment;
(3) upon a question reserved by the prosecution; or
(4) upon an order granting a new trial in any case involving a class A of B felony or for crimes committed on or after July 1, 1993, in any case involving an off-grid crime."
K.S.A. 22-3603 provides for interlocutory appeals by the State as follows:
"When a judge of the district court, prior to the commencement of trial of a criminal action, makes an order quashing a warrant or a search warrant, suppressing evidence or suppressing a confession or admission an appeal may be taken by the prosecution from such order if notice of appeal is filed within ten (10) days after entry of the order. Further proceedings in the trial court shall be stayed pending determination of the appeal."
We held in Unruh I that the attempted interlocutory appeal by the State did not involve any of the statutory provisions for interlocutory appeals by the State, nor was it a final order arresting judgment as argued by the State. Therefore, we found no jurisdiction to consider the appeal. 259 Kan. at 824-25.
In State v. Grimes, 229 Kan. 143, 146, 622 P.2d 143 (1981), which involved an attempted interlocutory appeal by the State from an order granting a new trial, we said:
"When the State filed its notice of appeal in September of 1979, the case was pending. A new trial had been ordered. The appeal was interlocutory, one taken between the commencement and termination of the action in the trial court. The order did not terminate the case; it directed that a trial be held. The legislature provided for interlocutory appeals by the State by K.S.A. 1980 Supp. 22-3603. This appeal, however, did not fit within the confines of that statute; the trial court made no order quashing a warrant or search warrant, no order suppressing evidence or a confession or admission. Thus the attempted appeal was not one authorized by 22-3603."
As in Grimes, the interlocutory appeal taken by the State in this case did not fit any statutory category set forth by statute and we, therefore, dismissed for lack of jurisdiction. In Grimes, we held that the time taken by the State's appeal upon motion of the defendant to dismiss for a violation of his or her rights to a speedy trial is assessed against the State. 229 Kan. at 149. As a part of our *191 rationale, we quoted from State v. Hess, 180 Kan. 472, 477, 304 P.2d 474 (1956):
"`When the State appealed there was on file a sufficient information upon which the defendant had joined issue by his plea of not guilty. This Court had ordered a new trial; there were terms of court at which such trial might have been had; the appeal did not, of itself, prevent a retrial; there was no stay order. What prevented the prosecution from proceeding to try the defendant again? There was no obstacle which prevented it; the only thing which may explain the delay is that such retrial would have been effort wasted if the State's appeal had been successful. But in the face of the preemptory commands of the Bill of Rights and Section 62-1432, considerations of expediency can have no weight. The alternative would have been to secure defendant's consent to the delay or to force him to apply for a stay order, but neither of these was done.'"
In this case, nothing prevented the State from trying the defendant on the original charges once the district court invalidated the plea agreement. The only reason for the attempted interlocutory appeal was to avoid a possible waste of time in trying the case. The State should have proceeded to trial on the original charges rather than attempting an appeal that was not clearly authorized by any express statutory provision. While it is true that the State did not conclusively know its interlocutory appeal was without jurisdiction until our opinion, under Hess and Grimes and the statutes regarding criminal appeals by the State, considerations of expediency can have no weight in the face of the preemptory commands of the Kansas Constitution Bill of Rights and K.S.A. 22-3402(1).
The defendant has been in custody from the date of the filing of the charges. Under the provisions of K.S.A. 22-3402(1), the defendant has the right to be tried for these charges 90 days from his arraignment on the charges less any time caused by his or her delay. When this case came before the district court for trial after the interlocutory appeal had been dismissed for lack of jurisdiction, a full 2 years had elapsed. Under Grimes and Hess and our holding today, that time is charged against the State. We conclude that the defendant's right to a speedy trial under the provisions of K.S.A. 22-3402(1) was violated. Under these circumstances, in accord with the provisions of K.S.A. 22-3402(1), the defendant "shall be entitled to be discharged from further liability to be tried for the *192 crime[s] charged." We therefore reverse and remand for discharge of the defendant.
State's appeal on question reserved is dismissed; on defendant's cross-appeal, the decision of the district court is reversed, and the case is remanded with directions to discharge defendant.
