
19 Kan. App. 2d 456 (1994)
871 P.2d 1285
RANDOLPH C. CABRAL, Appellant,
v.
STATE OF KANSAS, Appellee.
No. 69,724
Court of Appeals of Kansas.
Opinion filed April 1, 1994.
Thomas Jacquinot, special appellate defender, of Lawrence, and Jessica R. Kunen, chief appellate defender, of Topeka for the appellant.
Timothy J. Chambers, county attorney, and Robert T. Stephan, attorney general, for the appellee.
Before LEWIS, P.J., ELLIOTT, J., and RON ROGG, District Judge, assigned.
LEWIS, J.:
In 1979, Randolph C. Cabral was convicted of aggravated kidnapping and rape. He was sentenced to life in prison for the aggravated kidnapping and 30 years to life for the rape. The conviction for aggravated kidnapping was reversed by the Kansas Supreme Court, and the rape conviction was affirmed. State v. Cabral, 228 Kan. 741, 619 P.2d 1163 (1980). In 1990, Cabral filed a K.S.A. 60-1507 motion, which was initially denied without an evidentiary hearing. We reversed the decision of the trial court and remanded. Cabral v. State, No. 65,783, unpublished opinion filed October 4, 1991.) This appeal is from the trial court's denial of relief on remand.
The issue raised in the 60-1507 motion was whether an immunity agreement between Cabral and the State was breached at the time of his sentencing for aggravated kidnapping and rape. On the first appeal to this court, we held that the trial court had not properly considered the issue. On remand, the trial court was instructed to determine whether the immunity agreement was violated and, if so, whether Cabral had waived his right to raise that issue. After our remand, the trial court conducted an evidentiary hearing and determined that the immunity agreement was not violated but concluded that, even if it was, Cabral had waived his right to raise the issue. This appeal followed.
The agreement in question was entered into in 1979. At that time, Cabral stood charged with illegal possession of marijuana. He was also well known to law enforcement officials in Reno *458 County. As a juvenile, he had exhibited a penchant for burglary and was known to defecate in the middle of the houses he burglarized. At the time of the agreement in question, he was represented by Kenneth F. Ehling, who is now deceased. The facts indicate that Cabral agreed to provide information clearing a number of unsolved burglaries and thefts in exchange for having the marijuana charge dismissed and being granted immunity from prosecution. Ultimately, an understanding was reached; Cabral provided information to the State to clear some 27 prior burglaries and thefts in exchange for a grant of immunity and the dismissal of the current charges.
The immunity agreement was oral and is somewhat lacking in specificity. After the information was disclosed, Joseph O'Sullivan, the then Reno County Attorney, wrote a letter to Ehling summarizing the agreement as follows:
"This letter is a follow-up to numerous meetings involving Randy Cabral, Det. Jake Koontz and you and me regarding the above captioned case and other matters. Principally, we discussed the matters listed subsequently in this letter on February 9 and February 16, 1979. At those meetings, we reached an agreement on the disposition of the above captioned case which is as follows.
"In exchange for information relating to the below listed criminal offenses, the Reno County Attorneys office will dismiss the matter entitled State vs. Randall Cabral, 78CR 352 with prejudice. The County Attorney further agrees not to refile the matter concerning the Burglary of Stanley Liquor Store and the assault of one Kathy Frazier. As a further part of the agreement Randy Cabral is given immunity from prosecution on any matter listed below and will not be called as a prosecution witness at any time in any proceeding relating to those offenses. It is understood that Randy Cabral's name may be used in affidavits associated with search warrants executed for the return of stolen merchandise from the below listed offenses. The matters which were discussed are as follows: [listing of 22 burglaries and thefts]."
This letter, along with a handwritten note taken at the time the immunity agreement was finalized, are the only documents from which that agreement can be verified.
As we understand the record, Cabral has never been prosecuted for any of the crimes disclosed and mentioned in the agreement, nor has he been called upon to testify concerning any of the matters stated. However, at the time of his sentencing for aggravated kidnapping and rape in 1979, O'Sullivan told the court:

*459 "Randy Cabral is no stranger to the courts of Reno County, Kansas, although he has only one prior felony conviction. He was granted a parole; he did serve time from the court, originally was paroled; went back again; was paroled again and went back again and finally flattened his time.
"As a juvenile he [had] an extensive record which one of his trademarks when he burglarized a house was to defecate in the middle of the house before he left according to Lieutenant Johnson of the Police Department.
"I can tell this court that as early as the spring of 1979 Mr. Cabral had a felony possession of marijuana complaint dismissed against him in exchange for his cooperation in clearing 27 burglaries and thefts. At that time it was discussed with him Mr. Cabral, your slate is clean. You have immunity from prosecution for any crime that you've committed. You can start anew in this community. You can clear everything because we're not going to prove it anyway and he did his best; and the discussions were had at that time that now it can be a new life if you want it.
"He then commits this crime which I think makes it that much more reprehensible and considering the background that he had and the time that he spent in the penitentiary and the penalty he knows one faces for committing crimes this still happened."
At the time O'Sullivan made this statement, Cabral was present in court with counsel. However, there was no objection by Cabral or his attorney to these remarks. It was not until 1990 when the present 60-1507 motion was filed that Cabral raised the issue of the remarks violating his immunity agreement. Cabral testified that while O'Sullivan was making the remarks, he turned to his attorney and said: "I don't think he's supposed to be saying those things or mentioning any of that stuff." According to Cabral, his attorney replied, "[I]t doesn't make any difference; you're going to do a life sentence anyway." This statement was indeed prophetic and remained accurate up until the time the Kansas Supreme Court vacated the aggravated kidnapping conviction. In any event, no contemporaneous objection was made as to the prosecutor's comments.
At the hearing on remand, a letter from Kenneth Ehling to Cabral was introduced as evidence. According to Ehling, O'Sullivan told him the day before sentencing that he would not refer to the immunity agreement at sentencing. O'Sullivan was called as a witness and denied telling Ehling any such thing and emphatically denied that he had breached or violated the immunity agreement in any fashion.
*460 The argument which Cabral puts forth is that O'Sullivan breached the immunity agreement by his remarks disclosing that agreement and the crimes "cleared" as a result of the agreement at the time of Cabral's sentencing. Cabral argues that we should vacate his sentence because of this breach of the immunity agreement and remand for resentencing.
The judge who imposed the sentence for aggravated kidnapping and rape on Cabral was J. Stanley Hill. Judge Hill is no longer active in the judiciary. However, Judge Hill did testify at the hearing on remand that, in sentencing Cabral, he did not consider O'Sullivan's remarks concerning unprosecuted burglaries. The life sentence for aggravated kidnapping was required by statute. The sentence for rape was doubled under the Habitual Criminal Act.
The question we must determine is whether the remarks of O'Sullivan violated the immunity agreement. If they did, we must then decide whether that violation requires us to vacate Cabral's sentence. We conclude that the remarks were improper and breached the spirit, if not the literal terms, of the immunity agreement. However, we are unable to conclude that the breach requires us to vacate the sentence imposed. We affirm, but we do so on a different rationale than that adopted by the trial court.
WAS THE IMMUNITY AGREEMENT BREACHED?
As pointed out earlier in this opinion, the immunity agreement itself was oral and its terms were verified by a letter from O'Sullivan to Ehling. This letter and a set of handwritten notes made at the time the immunity agreement was reached outlined the understanding in rather abbreviated form. The net result is that the agreement is somewhat vague. It does not expressly prohibit its use at sentencing for a subsequent unrelated crime. In our opinion, the terms under which information was given by Cabral are vague and ambiguous. The net result is that we will construe the agreement strictly against the State and in favor of Cabral.
Traditionally, there are three types of immunity recognized by the law in these United States. They are described in 21 Am.Jur.2d, Criminal Law § 210, page 386, as follows:
"There are three recognized types of immunity: (1) `transactional,' (2) `use and derivative use,' and, (3) `use.' `Transactional' immunity protects the witness from prosecution for offenses to which the compelled testimony relates. This type of immunity is broader than the constitutional privilege *461 against self-incrimination and need not always be granted, although it does, of course, constitute adequate immunity. `Use and derivative use' immunity protects the witness from the use of compelled testimony and evidence derived therefrom. It is coextensive with the constitutional privilege against self-incrimination and is therefore a sufficient grant of immunity to compel self-incriminatory testimony. On the other hand, mere `use' immunity, which only prevents the prosecution from using the compelled testimony in any criminal proceeding, is not constitutionally adequate since it does not prevent prosecuting authorities from making derivative use of the fruits of a witness' compelled testimony by obtaining investigatory leads from it."
In Kansas, K.S.A. 22-3415 authorizes a written grant of immunity for the purpose of compelling testimony. The Kansas Supreme Court has determined: "It appears from our reading of the statute that both a transactional immunity and a use immunity is provided." In re Birdsong, 216 Kan. 297, 304, 532 P.2d 1301 (1975).
The problem in this action is that immunity was not granted pursuant to K.S.A. 22-3415. The grant of immunity was not in writing, and it was not granted to compel testimony. In fact, the letter from O'Sullivan to Ehling specifically prohibits calling Cabral as a witness in any prosecution for the crimes disclosed. We are unable to construe that agreement under the terms of K.S.A. 22-3415.
It is not particularly important to affix a label to the immunity involved in the instant matter. The purpose of a grant of immunity is to protect an individual's privilege against self-incrimination while gaining information or testimony not otherwise obtainable. The purpose of the privilege against self-incrimination is not difficult to ascertain:
"The Supreme Court on many occasions has stated that the purpose of the privilege against self-incrimination is "`to insure that a person should not be compelled, when acting as a witness in any investigation, to give testimony which might tend to show that he himself had committed a crime.'" Lefkowitz v. Turley, 414 U.S. 70, 77, 94 S. Ct 316, 322, 38 L.Ed.2d 274 (1973) (quoting Counselman v. Hitchcock, 142 U.S. 547, 562, 12 S. Ct 195, 35 L.Ed. 1110 [1892] (emphasis added)). Thus, the privilege usually applies to prohibit testimony that might incriminate a witness for past crimes. See Rule v. United States, 362 F.2d 215, 217 (5th Cir.1966), cert. denied, 385 U.S. 1018, 87 S.Ct. 744, 17 L. Ed 2d 554 (1967)." United States v. Quatermain, Drax, 613 F.2d 38, 41-42 (3d Cir.1980).
*462 The grant of immunity from the standpoint of a defendant is to protect his or her privilege against self-incrimination. Immunity makes it possible for an individual to reveal criminal conduct without fear that his or her own words may be used to incriminate or punish him or her in the future. Where the extent of the grant of immunity is vague or ambiguous, we will construe it as being coextensive with the constitutional privilege against self-incrimination. This approach is consistent with the decision of State v. Durrant, 244 Kan. 522, 769 P.2d 1174 (1989). In that case, the court was called upon to determine the extent of immunity granted by K.S.A. 79-5201 et seq. Chief Justice, then Justice, Holmes, writing for a unanimous court, said:
"The district court in case No. 62,560 held that the statute fails to provide absolute immunity and does not prohibit use of the information for investigatory leads, a use the court held was barred by the privilege. Defendants also raise this argument on appeal. For a statutory grant of immunity to be coextensive with the privilege against self-incrimination, it must grant not only use immunity, or protection from the direct use of compelled incriminatory information, but also derivative-use immunity, which prohibits use of any such information for investigatory purposes leading to other evidence of criminal activity. This court not only has the authority, but also the duty, to construe a statute in such a manner that it is constitutional if the same can be done within the apparent intent of the legislature in passing the statute. To accomplish this purpose the court may read the necessary judicial requirements into the statute. [Citations omitted.] We think it is obvious, and we so hold, that the legislature, by its enactment of 79-5206 as a part of the act, intended to extend not only use immunity but also derivative-use immunity to any person complying with the act. As construed, the immunity granted by the act is at least coextensive with the privilege against self-incrimination provided by the Fifth Amendment of the United States Constitution, and the act as so construed is constitutional." 244 Kan. at 534-35.
In this case, the full extent of the immunity granted is shrouded by ambiguity. The agreement neither permits, nor does its specifically prohibit, the use of the information in the manner objected to on this appeal. In line with State v. Durrant, we construe the agreement in question as granting to Cabral that immunity which is coextensive with the privilege against self-incrimination.
As we view it, the privilege against self-incrimination bars the use of information by the State obtained under a grant of immunity *463 from being used punitively in a criminal prosecution against the party providing that information. Obviously, this information could not be used to prosecute Cabral for the crimes revealed. He could not be forced to testify about those crimes under the express terms of the agreement. It seems only logical that any use of the information by the State to punish Cabral for the crimes disclosed would be prohibited.
The statement by O'Sullivan was made at a hearing being held to determine Cabral's sentence for aggravated kidnapping and rape. We believe the purpose of the statement was obvious. The State was seeking to affect the sentencing process by revealing past crimes, which it had become aware of by Cabral's own statement made under a grant of immunity. By any use of the term, the intent of the statement by O'Sullivan was to incriminate and punish Cabral with information given in exchange for immunity. This approach violates the spirit of the immunity agreement in question and certainly was intended to have a negative impact on Cabral's privilege against self-incrimination.
We hold that the use at sentencing of information of prior criminal conduct obtained under a grant of immunity violated the immunity agreement between Cabral and the State. It seems to us to be impermissible to permit the punitive use of prior criminal information against an individual who gave that information under an agreement providing for immunity. A contrary decision would significantly dilute the privilege against self-incrimination, which is to be protected by a grant of immunity. We think the use of such information violates the spirit under which the information was obtained and has a negative impact upon the integrity of the criminal justice system. We hold that the district court erred in finding that the disclosure of the information by O'Sullivan did not breach the immunity agreement.
DOES THE BREACH REQUIRE THAT CABRAL'S SENTENCE BE VACATED?
We have determined that the statements by the prosecutor disclosing information obtained from Cabral under a grant of immunity violated the immunity agreement between Cabral and the State. However, this decision does not automatically lead us to conclude that Cabral's sentence must be vacated. Our review of *464 the record leads us to conclude that the error by the State in disclosing the information was, under the facts of this record, harmless error.
The concept of harmless error is logical. Not every error requires reversal of a judgment. If an error has not prejudiced the substantial rights of the party complaining, it is not considered reversible error. "Errors which do not affirmatively appear to have prejudicially affected the substantial rights of the party complaining do not require reversal when substantial justice has been done." State v. Bell, 239 Kan. 229, 235, 718 P.2d 628 (1986). See State v. Getz, 250 Kan. 560, 571, 830 P.2d 5 (1992); State v. Peltier, 249 Kan. 415, Syl. ¶ 4, 819 P.2d 628 (1991), cert. denied ___ U.S. ___, 120 L.Ed.2d 875 (1992); State v. Maggard, 16 Kan. App.2d 743, 753, 829 P.2d 591, rev. denied 251 Kan. 941 (1992).
It was the burden of Cabral to demonstrate that whatever error occurred at the time of his sentencing prejudicially affected his substantial rights. We conclude that he failed to do so.
The error in this action is of constitutional magnitude. Accordingly, our standard of review is somewhat more strict than is set forth above.
"An error of constitutional magnitude is serious and may not be held to be harmless unless the appellate court is willing to declare a belief that it was harmless beyond a reasonable doubt. [Citations omitted.] ... [B]efore we may declare the error harmless, we must be able to declare beyond a reasonable doubt that the error had little, if any, likelihood of having changed the result of the trial. [Citation omitted.]" State v. White, 246 Kan. 28, 37, 785 P.2d 950, aff'd as modified 246 Kan. 393, 789 P.2d 1175 (1990).
See Chapman v. California, 386 U.S. 18, 17 L.Ed.2d 705, 87 S.Ct. 824, reh. denied 386 U.S. 987 (1967); State v. Galloway, 16 Kan. App.2d 54, 61, 817 P.2d 1124, rev. denied 249 Kan. 777 (1991).
We have carefully read the record of the K.S.A. 60-1507 hearing, as well as the record of the defendant's sentencing for aggravated kidnapping and rape in 1979. Our review of the record convinces us that, beyond a reasonable doubt, the error had little, if any, likelihood of having changed the result of the defendant's sentence. Since we deal here only with the sentence imposed upon the defendant for rape, we would vacate that sentence only *465 if we believed beyond a reasonable doubt that but for the prosecutor's comments, the defendant would not have received the sentence of 30 years to life on the rape conviction.
The record overwhelmingly indicates that the prosecutor's breach of the immunity agreement did not prejudice the defendant's substantial rights. Indeed, the evidence shows that the disclosure by the prosecutor of the crimes revealed by the immunity agreement had no effect on the sentence imposed on Cabral.
J. Stanley Hill, the judge who sentenced Cabral in 1979, testified that he did not consider the facts relating to the immunity agreement in imposing the sentence on Cabral. The judge testified that his sentence was based on the factors listed in the statute, supplemented by the personal knowledge he gained in presiding over the trial and the presentence investigation report. He testified flatly that prior unconvicted crimes would not enter into his decision in sentencing a defendant.
We have examined the sentencing transcript from the 1979 sentence. That record is very clean and very clear. Judge Hill meticulously went through every factor listed in the statute and evaluated those factors as they related to the defendant and the crimes he stood convicted of. There is not even a hint in the sentencing record that the prosecutor's mention of the immunity agreement affected in any way the sentence imposed. The testimony of the trial judge, along with our examination of the sentencing record, convinces us beyond a reasonable doubt that there is no likelihood that the sentence would have been any different had the prosecutor not revealed the immunity agreement and the crimes disclosed by that agreement.
In addition, there is the factor of the Habitual Criminal Act. Cabral is presently serving a sentence of 30 years to life. This sentence was imposed by doubling the statutory maximum sentence under the Habitual Criminal Act. Cabral's current sentence for rape was arrived at under the Habitual Criminal Act because he had a prior felony conviction, and it does not appear to be related in any way to the improper disclosure of information by the prosecutor. When one considers the crimes for which Cabral was convicted and the application of the Habitual Criminal Act, a sentence of 30 years to life for rape appears to have been *466 appropriate and unrelated to any improper revelation of information by the prosecutor. The sentence is within statutory limits and was enhanced, not because of the disclosure of information by the prosecutor, but as a result of the Habitual Criminal Act. We have no hesitation in concluding that, although the prosecutor's mention of the immunity agreement was wrongful and erroneous, it was harmless error at best. We conclude there is no basis on which to vacate the defendant's sentence and remand for resentencing.
We are aware that the basis for our decision is different from that reached by the trial court. The trial court concluded that, even if the agreement was breached, Cabral had waived any right to raise this issue. The waiver issue is based upon the failure of Cabral to object to the mention of the immunity agreement at the time of sentencing. A critical factor to be determined by the trial court was whether Cabral was aware of the fact that the prosecutor's mention of the terms of the agreement constituted a breach. We think it clear from our reading of the record that Cabral was indeed aware of this fact. The trial court reasoned that, while Cabral was aware of the error at the time it occurred, he waited 10 years to raise the issue. The trial court concluded that this gap in time was, in fact, a waiver of the right to raise the issue. We choose not to decide this case on the waiver issue. However, we affirm the trial court on the basis of the harmless error analysis set forth in this opinion. "[W]here the trial court reaches the correct result based upon the wrong reason, this court will affirm the trial court." State v. Shehan, 242 Kan. 127, 131, 744 P.2d 824 (1987). See State v. Donlay, 253 Kan. 132, 853 P.2d 680 (1993); State v. Zimmerman, 251 Kan. 54, 67, 833 P.2d 925 (1992); State v. Wilburn, 249 Kan. 678, 686, 822 P.2d 609 (1991).
We disagree with the trial court's decision that the mention of the immunity agreement by the prosecutor did not violate the terms of that agreement. However, we affirm the trial court's denial of the petitioner's 60-1507 motion.
Affirmed.
