
147 N.W.2d 370 (1966)
STATE of Minnesota, Respondent,
v.
Dale R. YOUNGREN, Appellant.
No. 39927.
Supreme Court of Minnesota.
December 23, 1966.
*371 D. O. Comer and D. W. Hassenstab, Hutchinson, C. Paul Jones, Public Defender, Henry Feikema, Minneapolis, for appellant.
Robert W. Mattson, Atty. Gen., Gerard Snell, Sol. Gen., St. Paul, for respondent.

OPINION
OTIS, Justice.
Defendant appeals from a conviction for rape for which he was sentenced to an indeterminate term of 7 to 30 years in the State Prison. He was originally charged with having raped one Karen Braun on April 3, 1963, in Sibley County. The information alleged that the victim's resistance was forcibly overcome. In July 1964, defendant was arrested in Florida, waived extradition, and was brought to Minnesota for trial. At a preliminary hearing in the criminal division of the probate court the victim testified among other things that she consumed no alcohol the night of the offense, she had visited no saloons or taverns that evening, and defendant had not kissed her prior to the crime. At that hearing in the presence of defendant's counsel the county attorney moved to amend the complaint to charge that "the resistance of the said Karen Braun was prevented by her fear that the said Dale Youngren would inflict immediate and great bodily harm upon her," bringing the charge within paragraph (3) rather than paragraph (2) of Minn.St. 617.01. Over defendant's objection that motion was granted.
In September 1964 the defendant was arraigned on the amended information and pled not guilty. The following month counsel for defendant appeared before the district court and stated that his client was prepared to plead guilty to the crime of *372 assault in the second degree.[1] Thereupon, the county attorney recommended that defendant's request be honored for reasons set forth in an accompanying affidavit, advising the court that the victim had committed perjury at the preliminary hearing in important particulars referred to above, which, in the words of the county attorney, would make a prosecution for rape "border upon an unjust undertaking."[2] In response the court stated:
"* * * [T]he Court is also of the opinion that the interest of justice will be served by accepting the plea which has been offered at this time * * *.
* * * * * *
"* * * [Y]our plea of guilty will be recorded."
The defendant was then sworn and a presentence interrogation was conducted by the court. In the course of the examination defendant stated that he was intoxicated the night of the offense and didn't know what he was doing or whether he intended to harm the victim. He did not observe any evidence that she had been injured. At that point the court stated:
"Under these circumstances, gentlemen, I have my doubts whether we should accept his plea."
Thereupon the following colloquy occurred:
"MR. SCOTT [county attorney]: I think, Your Honor, if it please the Court, the statement the accused has made with reference to your inquiry would seem to indicate great inconsistencies to a plea of guilty to any charge. For this reason I would request the Court to allow me to withdraw my recommendation on the acceptance of a lower charge with the idea the State will have to proceed as if this application had not been made.
"THE COURT: The plea of guilty to the charge as stated is set aside and also the Court vacates its order accepting the plea to the assault charge leaving the charge as originally filed stand and the plea of not guilty to the crime charged therein will stand of record and this matter will proceed for trial as soon as counsel for the Defendant and the State can arrange for that."
Nothing in the record shows that either defendant or his counsel objected to the ruling or questioned the order reinstating the rape charge.
We have in a number of recent cases stressed the impropriety of accepting a plea of guilty where statements made by the defendant at the time of arraignment or sentencing are inconsistent with his guilt.[3] While we do not necessarily agree that the defendant's answers required the court to rule as it did, it was nevertheless the court's duty and prerogative to set aside the plea if he concluded that there was an inconsistency. However, by refusing to accept a plea of guilty to assault, the court was not compelled to reinstate the charge of rape. As we view the matter, upon the request of the prosecutor that the court accept a plea of guilty to a lesser offense because he believed the more serious charge to be unwarranted, followed by the defendant's entering a plea and the court's formally accepting and recording it in the minutes, there was under the circumstances an abandonment of the original charge which foreclosed further proceedings with respect to that offense.[4]
*373 We recognize that ordinarily a defense of the kind here considered must be affirmatively asserted in the trial court or it is waived. However, where both the court and the prosecutor have expressed grave misgivings concerning the justice and propriety of proceeding with the prosecution, and the court in attempting to protect defendant has refused to accept a plea of guilty to a lesser charge and has thereby unwittingly exposed defendant to a maximum term of 30 years rather than 5 years, the result is so unfair as to justify our granting relief. Accordingly, we hold that the defendant's conviction for rape is reversed and he is herewith discharged with respect to that offense. However, the matter is remanded to the district court with leave to proceed with the prosecution against the defendant for assault in the second degree, as to which defendant may elect to plead guilty or stand trial.
In the event defendant is convicted, he will be given credit on any sentence thereupon imposed for the term he has already served as well as for the time he was held in custody pending his first trial. § 609.145.
Reversed and remanded.

APPENDIX
The affidavit reads as follows:
"William P. Scott, County Attorney for Sibley County, Minnesota, being first duly sworn, on oath deposes and says:
"On October 8, 1964, the complainant in the above case, Karen Braun Quick, appeared voluntarily at the office of the undersigned, as County Attorney. At that time and place said complainant told the undersigned that she had deliberately lied and falsified her statements to the LeSueur County Sheriff, Pat Smith Sr., to the Sibley County Sheriff, Herman Schulte, to the then Sibley County Attorney, the late Robert G. Williamson, all said statements being made on April 3, 1963, and, further, had lied and falsified her unsworn statement to the undersigned and her statement under oath before the Hon. Kenneth W. Bull, Sibley County Probate Judge, who presided at the preliminary hearing in the action held on August 19, 1964.
"The particulars of said lies and falsifications were as follows:
"1. That prior to meeting the accused on the evening of April 2, and the early morning of April 3, 1963, she had consumed no alcoholic drinks.
"The fact was that she did consume alcoholic drinks on April 2, 1963, prior to meeting the defendant.
"2. That prior to meeting the accused on the evening of April 2nd and the early morning of April 3, 1963, she had visited no saloons or taverns in LeSueur, Minnesota.
"The fact was that she did visit the Green Mill Bar and Hix's Bar in LeSueur on April 3, 1963.
"3. That prior to the accused stopping his car on a deserted gravel road in Henderson Township, Sibley County, Minnesota, that he had not kissed the complainant.
"The fact was that accused did kiss complainant once before driving to the location stated above.
"The undersigned confirmed the variations in numbers (1) and (2) above from other witnesses, but was unable to corroborate the variation at (3) above, primarily because only the accused and the complainant were present.
"Complainant gave undersigned as her reasons for the falsifications that (1) she was afraid the truth would adversely affect her alleged lack of consent to sexual acts with accused, and (2) that her parents were present at the earlier statements and she was afraid to indicate to them that she had so foolishly placed herself in a position where she would be so vulnerable to the attacks by the accused.
*374 "The undersigned also informs the Court that defense counsel is aware of the variations and the implications thereof. The false testimony seriously embarrasses the State, and in the opinion of the undersigned, creates a serious question as to whether a conviction for rape could be obtained under the circumstances. Further, the evidence of drinking and the single kiss, several times deliberately hidden and falsified by the complainant, could, in its most favorable impact in favor of defense, raise serious doubts in the minds of the triers of the facts as to the lack of consent to the sexual act by the prosecutrix. The undersigned also informs the Court of his reluctance to proceed with a rape prosecution where the principal State evidence is the declaration and identification of and by the complainant, now admittedly a perjurer. In spite of accused's prior felony conviction, to proceed with the rape prosecution would appear to the undersigned, in light of the circumstances herein disclosed, to border upon an unjust undertaking.
"The undersigned further informs the Court that as an incident surrounding the alleged rape was a severe beating of complainant by the accused with his fists. As a result of this assault by accused, the complainant suffered a broken nose, and was cut, bruised and bleeding, which, in the considered opinion of the undersigned would come within the definition of assault in the second degree, under the provisions of M.S.A. 619.38(3). The accused, upon advice of his counsel, and upon deliberation, and without any promises upon the part of the undersigned to induce such, has indicated willingness to plead guilty to the offense of Assault in the Second Degree (M.S.A. 619.38(3), a felony, a lesser offense included within the offense of rape with which he is charged. The accused has been informed of the possible penalties to which his plea of guilty would subject him. The undersigned, therefore, pursuant to the provisions of M.S.A. 630.30, hereby respectfully petitions the Court to accept a plea of guilty from the accused to the crime of Assault in the Second Degree, on the grounds that the acceptance of such a plea would be fair and just from the standpoints of both State and accused.
"Further the undersigned sayeth not.
               "/s/ William P. Scott."
NOTES
[1]  Minn.St.1961, § 619.38 (now Minn.St. 609.225).
[2]  See Appendix.
[3]  State v. Jones, 267 Minn. 421, 127 N.W.2d 153; State v. Olson, 270 Minn. 329, 133 N.W.2d 489.
[4]  Cf. Crutchfield v. Commonwealth, 187 Va. 291, 46 S.E.2d 340; People v. Griffin, 7 N.Y.2d 511, 199 N.Y.S.2d 674, 166 N.E.2d 684; People v. Mims, 136 Cal.App.2d 828, 289 P.2d 539.
