                           NOT DESIGNATED FOR PUBLICATION

                                             No. 119,960

               IN THE COURT OF APPEALS OF THE STATE OF KANSAS

                                           STATE OF KANSAS,
                                               Appellee,

                                                  v.

                                     TYLER LLOYD MCCARLEY,
                                            Appellant.


                                    MEMORANDUM OPINION

        Appeal from Lyon District Court; JEFFRY J. LARSON, judge. Opinion filed March 13, 2020.
Sentence vacated and case remanded with directions.


        Sam Schirer, of Kansas Appellate Defender Office, for appellant.


        Meghan K. Morgan, assistant county attorney, Marc Goodman, county attorney, and Derek
Schmidt, attorney general, for appellee.


Before ATCHESON, P.J., BRUNS, J., and BURGESS, S.J.


        PER CURIAM: Defendant Tyler Lloyd McCarley entered an agreement with the
State to plead no contest to two felonies with a joint recommendation to the Lyon County
District Court for a controlling sentence of 92 months expressly predicated on his being
in criminal history category A and receiving an upward durational departure doubling the
maximum guidelines sentence on the primary conviction for attempted aggravated
burglary and a like departure doubling the midrange guidelines sentence on the other
conviction for aggravated battery to be served consecutively. At sentencing, it turned out
McCarley actually was in criminal history category B. The district court, nonetheless,

                                                   1
sentenced him to serve 92 months for the attempted aggravated burglary, citing the
agreement of the parties, and imposed a concurrent 12-month term on the aggravated
battery.


       On appeal, McCarley challenges the 92-month sentence for the attempted
aggravated burglary conviction as illegal under K.S.A. 22-3504. We agree and, therefore,
vacate that sentence and remand to the district court with directions to impose a lawful
sentence on the aggravated burglary conviction.


       In April 2017, the State charged McCarley with aggravated burglary, severity
level 7 aggravated battery, attempted felony theft, and misdemeanor theft and later
amended the complaint to up the aggravated battery to a severity level 4 crime. The facts
giving rise to the charges are irrelevant to the sentencing issue on appeal, so we needn't
discuss them. In October 2017, the State and McCarley entered into the plea agreement
we have already briefly outlined.


       Under the agreement, the State reduced the aggravated burglary to an attempt, a
severity level 7 person felony; reverted to the severity level 7 aggravated battery, also a
person felony; and dismissed the remaining charges. The agreement called for McCarley
to plead no contest to those two charges. In the agreement, McCarley acknowledged
(incorrectly) that he had a criminal history score of A and, thus, faced a potential
controlling guidelines sentence of 47 months. That would reflect a maximum guidelines
sentence of 34 months on the attempted aggravated burglary, as the primary crime, and a
maximum guidelines sentence of 13 months on the aggravated battery imposed as
consecutive terms of incarceration. In turn, each of those sentences could be doubled,
reflecting statutory upward durational departures and yielding a controlling term of 94
months in prison. In the written plea agreement, the State and McCarley note they will
jointly recommend that the district court impose a 92-month prison term. The parties
presented the plea agreement to the district court. McCarley entered the no-contest pleas.

                                              2
And the district court found him guilty of attempted aggravated burglary and aggravated
battery.


       At the sentencing hearing, the parties and the district court concluded McCarley
actually had a criminal history score of B, thus reducing the guideline sentences that
could be imposed. As we have indicated, the district court sentenced McCarley to 92
months in prison for the attempted aggravated burglary and relied on the terms of the plea
agreement to justify that result. With a criminal history score of B, McCarley actually
faced a maximum guidelines sentence of 31 months on the attempted aggravated burglary
that could have been doubled to 62 months through an upward durational departure. The
92-month term exceeded the longest sentence that could have been imposed under the
governing statutes. As we have said, the district court imposed a concurrent standard
guidelines sentence of 12 months on the aggravated battery conviction. That reflected a
statutorily proper sentence.


       McCarley has appealed on the grounds the 92-month sentence is illegal. Under
K.S.A. 2019 Supp. 22-3504(a), a defendant may challenge an illegal sentence at any
time, so long as he or she continues to serve the sentence. As defined in K.S.A. 2019
Supp. 22-3504(c)(1), an illegal sentence includes one that "does not conform to the
applicable statutory provision, either in character or punishment." That statutory
definition, adopted in 2017, simply codifies one of the grounds the Kansas Supreme
Court had recognized would render a sentence illegal. See State v. Trotter, 296 Kan. 898,
902, 295 P.3d 1039 (2013). The logic of the definition is inescapable: If the punishment
imposed in a sentence deviates from the controlling statutes, it must be outside those
statutes and, thus, illegal. The parties cannot agree or stipulate to an illegal sentence.
State v. Lehman, 308 Kan. 1089, Syl. ¶¶ 1-2, 427 P.3d 840 (2018). A district court, in
turn, can't oblige them by imposing one.




                                               3
       Those principles dispose of this appeal. The 92-month sentence does not conform
to the sentencing guidelines or the governing statutes. It is, in a word, illegal.


       The State suggests that if we were to find the sentence for the attempted
aggravated burglary illegal, as the primary crime, we should also consider vacating the
sentence for the aggravated battery and declaring the plea agreement void based on the
frustration of purpose doctrine. The State cites State v. Boley, 279 Kan. 989, 113 P.3d
248 (2005), in which the Kansas Supreme Court considered but declined to apply the
doctrine to the disputed plea agreement in that case. Frustration of purpose is a contract
principle that recognizes the parties may be relieved of their bargain when unanticipated
circumstances that could not fairly be considered an assumed risk effectively preclude the
performance of either party in a way that would be of benefit to the other. 279 Kan. at
994; Restatement (Second) of Contracts § 265 (1981).


       Consistent with Boley, the doctrine does not apply here. A basic purpose of a plea
bargain is to eliminate the uncertainty of a jury trial for both the State and the defendant
typically by substituting reduced charges or a recommended sentence that is less severe
that what might be anticipated following a conviction at trial or both. But a plea
agreement is not without certain risks. For example, in fashioning a recommended
sentence, both sides make assumptions about the defendant's correct criminal history,
which drives the presumptive guidelines sentence in tandem with the offense level of the
crime of conviction. Those assumptions may turn out to be wrong, as happened here.
Likewise, although a district court is constrained to impose a legal sentence, it is not
bound by a jointly recommended sentence. So it may impose a punishment that is harsher
or more lenient than the recommendation.


       We fail to see frustration of purpose flowing from our decision finding the 92-
month sentence to be illegal. The State retains both convictions against McCarley, each
for a person felony, and on remand he faces a significant prison term on resentencing for

                                               4
the attempted aggravated burglary. Moreover, the risk that a given defendant's actual
criminal history may differ from what either side predicated a plea bargain on is entirely
foreseeable. In this case, the risk of an erroneous criminal history effectively fell
exclusively on the State, since the parties assumed McCarley would be in the highest
criminal history category. But there is nothing manifestly unfair about that, especially
since the State has an array of resources to investigate and confirm a defendant's criminal
record. In short, the essential purpose of the plea agreement has not been lost because the
district court imposed an illegal sentence on McCarley.


       On remand, the district court can only resentence McCarley on the attempted
aggravated burglary conviction. Because the district court originally imposed a lawful
sentence on McCarley for the aggravated battery conviction, it cannot now revise that
sentence. Nor can the district court impose the new sentence on the attempted aggravated
burglary consecutive to the existing sentence on the aggravated battery. See State v.
Guder, 293 Kan. 763, 766-67, 267 P.3d 751 (2012).


       We, therefore, vacate the sentence on the conviction for attempted aggravated
burglary and remand with directions to resentence McCarley on that conviction
consistent with this opinion.




                                              5
