
264 S.E.2d 96 (1980)
299 N.C. 727
STATE of North Carolina
v.
Steven Anthony PUCKETT.
No. 40.
Supreme Court of North Carolina.
April 1, 1980.
*97 Atty. Gen. Rufus L. Edmisten by Associate Atty. Grayson G. Kelley, Raleigh, for the state.
Stephens, Peed & Brown by Herman L. Stephens, Winston-Salem, for defendant-appellant.
BRITT, Justice.
Defendant was tried in district court on a magistrate's order and four warrants charging him with five misdemeanors: simple assault, possession of marijuana, illegally carrying weapons on school property, rioting, and assault with a deadly weapon. From verdicts of guilty and judgments entered in district court, he appealed to the superior court.
When the cases were called for trial in superior court, the court was advised that a plea arrangement had been agreed to by the state and defendant. A sentencing hearing was conducted, and defendant testified with respect to his willingness to plead guilty and his understanding of the arrangement that had been agreed to by the district attorney and his attorney. At the sentencing hearing, the following exchange took place:
Have you agreed to plead as a part of a plea bargainnow, let me advise you what is written on this piece of paper; that all charges be consolidated and that any sentence, if imposed, would run concurrent with the sentence you are now serving. This agreement includes probationary sentences in Davie County and two counts of aiding and abetting the charge of contributing to the delinquency of a minor. What sentence are you now serving?
A. Twelve years.[1]
Q. Twelve years?
A. Yes, sir.
Q. And your understanding is that if you enter these pleas of guilty, that the sentence will run concurrently with that twelve year sentence, is that right?
A. Yes, sir.
Q. Other than what I have just said and you have said to me, has there been any promise made to you or any threat made to you for you to enter these pleas of guilty?
A. No, sir.
Q. Do you have any questions you want to ask me about anything I have said to you?
A. No, sir.
Q. Do you know what you are doing?
A. Yes, sir.
Q. Do you now tell the Court of your own free will you wish to enter pleas of guilty to these charges?
A. Yes, sir.
THE COURT: All right, Mr. District Attorney, as I understand the plea transcript, *98 no objection to a concurrent sentence.

MR. LYLE: No, sir. (Emphasis added.)
Thereupon, the court, in the assault with a deadly weapon case, entered a judgment imposing a prison sentence of two years. The court consolidated the other four cases and entered a judgment imposing a prison sentence of two years, to begin at expiration of sentence in the assault with a deadly weapon case. The court then provided that "these sentences are to run concurrently with the twelve year sentence the defendant is now serving".
Later in the day after these judgments were entered, defendant, through his counsel, filed a written motion asking that the judgments be set aside, that he be allowed to withdraw his pleas of guilty, and that the cases against him revert to the status existing prior to the entry of the pleas. The reasons stated in the written motion for asking that the judgments and pleas be stricken were: (1) that at the time of entry of the pleas defendant thought that he would be freed on bond in these cases pending his appeal of the 12-year sentence; and (2) that he did not know that entering the pleas would result in the activation of a probationary sentence previously imposed in Davie County.
The court conducted a hearing on the motion. At that time defendant testified: "It was upon my understanding that any sentence that would be imposed upon me would run concurrent with the time I'm now serving. It was also my opinion that all charges would be consolidated together as one and the sentence would be imposed." Defendant then read from the written plea arrangement as follows: "Consolidate all charges and sentence to run concurrent with sentence now being served. Agreement includes probation sentence in Davie County on two counts of aiding and abetting contributing delinquency of a minor to run concurrent also".[2] He further testified that "I was of the opinion that all of these cases would be consolidated into one case for the purpose of judgment. It is my desire now that the Court set aside this plea bargaining, the transcript, and that I am ready to stand trial on all these cases."
On cross-examination defendant testified that the sentences he had received were not "exactly in accordance with that plea negotiation"; that the agreement stated that "all charges would be consolidated together" but they were not consolidated because he got two sentences.
We recognize the inconsistencies between what is said in the written motion filed by defendant's counsel and some of the statements made by defendant when he testified at the hearing on the motion. However, it does appear that defendant's contention that all five misdemeanors would be consolidated for purpose of one sentence is supported by the written plea arrangement. It is also noted above that the court in its interrogation of defendant repeatedly referred to "any sentence", "the sentence", and "a concurrent sentence".
Clearly, if the court had consolidated the five cases for purpose of one judgment, not more than a two-year prison sentencethe most severe statutory penalty for any of the offensescould have been imposed. State v. Austin, 241 N.C. 548, 85 S.E.2d 924 (1955); see also State v. Stafford, 274 N.C. 519, 164 S.E.2d 371 (1968). Defendant strenuously contends that the court violated the plea arrangement when it imposed two consecutive two-year sentences.
Defendant's contention is supported by the record. That being true, when the trial court determined that it would not agree to consolidate the five cases for purpose of imposing one sentence, it should have followed the provisions of G.S. 15A-1024 which are as follows:
§ 15A-1024. Withdrawal of guilty plea when sentence not in accord with plea arrangement.If at the time of sentencing, the judge for any reason determines to impose a sentence other than *99 provided for in a plea arrangement between the parties, the judge must inform the defendant of that fact and inform the defendant that he may withdraw his plea. Upon withdrawal, the defendant is entitled to a continuance until the next session of court.
For the reasons stated, the decision of the Court of Appeals affirming the judgments of the trial court is reversed. This cause is remanded to the Court of Appeals for entry of order requiring that the judgments of the trial court be vacated, that defendant's plea of guilty be stricken, and that the cases be reinstated on the trial docket.
Reversed and remanded.
NOTES
[1]  The twelve years referred to here consisted of a 10-year sentence and a 2-year sentence imposed by Judge Wood at the 30 November 1978 Session of Forsyth Superior Court. The sentences imposed in the instant cases are now quite significant to defendant in view of the fact that the Court of Appeals [State v. Puckett, 43 N.C.App. 596, 259 S.E.2d 310 (1979)] vacated the 10-year sentence imposed by Judge Wood.
[2]  While the record clearly discloses that there was a written plea arrangement entered into, the full text of the arrangement is not set forth in the record.
