Defendant does not challenge the validity of the trial and verdict at December 1964 Session. He contends, based on facts narrated below, that the judgment pronounced at said term is erroneous and excessive because it fails to credit on the two-year sentence it imposes the time between the date of the (subsequently vacated) judgment pronounced at May 1963 Session and the date of the judgment pronounced at December 1964 Session.
The minutes of the May 1963 Session show “defendant in person and thru his attorney, W. F. Briley,” pleaded nolo contendere to felonious assault as charged in the bill of indictment. Judgment, imposing a prison sentence of not less than five nor more than seven years, was *683pronounced. The said minutes contain no reference to when or by whom Mr. Briley was employed or appointed. On May 9, 1963 defendant was committed to State’s Prison to serve said sentence.
On September 25, 1964, after a habeas corpus hearing in the United States District Court for the Middle District of North Carolina, Stanley, Chief Judge, based on findings of fact and conclusions of law set forth in a memorandum opinion, “Oedebed, Adjudged and DeCReed that the petitioner’s plea of nolo contendere entered on May 9, 1963, and the judgment pronounced thereon, are vacated and set aside, and that the petitioner be granted a new trial.” It was “Euether Oedeeed” (1) “that unless the State of North Carolina elects to retry and retries the petitioner within six months from September 25, 1964, an Order will be entered, upon application of petitioner, discharging him from custody,” and (2) “that the petitioner be admitted to bond in the sum of $2,500.00 to be approved by the Clerk of the Superior Court of Ala-mance County, pending his new trial.” Apparently, defendant did not make bond and obtain his release “pending his new trial.” At his trial at December 1964 Session he testified he had been confined in Ala-mance County Jail since October 8, 1964.
Defendant was indicted for assault with a deadly weapon with intent to kill, inflicting serious injury not resulting in death, the felony created and defined by G.S. 14-32. S. v. Jones, 258 N.C. 89, 128 S.E. 2d 1. Upon conviction, the punishment prescribed by the statute is imprisonment “for a period not less than four months nor more than ten years.”
Assault with a deadly weapon is a general misdemeanor, punishable by fine or imprisonment or both, “at the discretion of the court,” G.S. 14-33, the maximum legal sentence therefor being two years. S. v. Austin, 241 N.C. 548, 550, 85 S.E. 2d 924. It is an essential element of the felony created and defined by G.S. 14-32, being an included “less degree of the same crime.” G.S. 15-170; G.S. 15-169.
At defendant’s trial at December 1984 Session on said felony indictment, there being evidence such included crime of less degree was committed, the court properly instructed the jury that guilty of an assault with a deadly weapon was a permissible verdict. S. v. Hicks, 241 N.C. 156, 84 S.E. 2d 545; S. v. Jones, 264 N.C. 134, 141 S.E. 2d 27. The jury acquitted defendant of the felony charge but found him guilty of assault with a deadly weapon, a general misdemeanor.
The following distinction is noted: From the pronouncement of judgment at May 1963 Session until said judgment was vacated by Judge Stanley’s order of September 25, 1964, defendant’s de facto status was that of a prisoner serving a sentence. From September 25, 1964 until the pronouncement of judgment at December 1964 Session, defendant’s *684status was that of a person under indictment awaiting trial and in custody on account of failure to give the appearance bond fixed by Judge Stanley’s order.
The Attorney General’s position is that, under our decisions in S. v. Williams, 261 N.C. 172, 134 S.E. 2d 163; S. v. White, 262 N.C. 52, 136 S.E. 2d 205, cert. den., 379 U.S., 85 S. Ct. 726, 13 L. Ed. 2d 707; S. v. Anderson, 262 N.C. 491, 137 S.E. 2d 823; S. v. Slade, 264 N.C. 70, 140 S.E. 2d 723, defendant is not entitled to any credit as a matter of right.
The present case is factually distinguishable from Williams, White, Anderson and Slade in one respect, namely, that this defendant, when retried on the identical bill of indictment, was not convicted of the identical crime (the felony) but of an included “less degree of the same crime.” It is factually distinguishable from White, Anderson and Slade, but not from Williams, in this respect: The judgment pronounced at December 1964 Session, upon defendant’s conviction of assault with a deadly weapon, imposed the maximum legal sentence. In White, Anderson and Slade, the total of the sentence pronounced at retrial and the time served under the vacated judgment was within the legal maximum.
The Goff cases, discussed below, bear upon defendant’s status during the period from the pronouncement of judgment at May 1963 Session until said judgment was vacated by Judge Stanley’s order of September 25, 1964.
At August 1961 Criminal Term of Pitt, Arthur Goff, in Case No. 7752, was indicted and convicted of felonious assault and sentenced to a prison term of not less than seven nor more than ten years. Subsequently, in post-conviction proceedings, the verdict, judgment and commitment were vacated on the ground that, applying retroactively the 1963 decision in Gideon v. Wainwright, 372 U.S. 335, 9 L. Ed. 2d 799, 83 S. Ct. 792, 93 A.L.R. 2d 733, which overruled the 1942 decision in Betts v. Brady, 316 U.S. 455, 86 L. Ed. 1595, 62 S. Ct. 1252, Goff had been denied his constitutional right to counsel. S. v. Goff, 263 N.C. 515, 139 S.E. 2d 695, decided January 15, 1965.
On August 10, 1964, while serving said sentence in Case No. 7752, Goff escaped; and, at January-February 1965 Session of Sampson, he pleaded guilty to said escape and judgment imposing a sentence of six months was pronounced. In habeas corpus proceedings, Goff contended his plea and the judgment in said escape case should be vacated on the ground he was not in lawful custody when the alleged escape occurred. On certiorari to review an order releasing Goff from custody in respect of said sentence for said escape, this Court reversed. Our decision was based on the proposition that the judgment pronounced in Case No. 7752 at August 1961 Criminal Term was not void. It was erroneous, *685voidable at the instance of defendant; and an escape while in custody pursuant to said judgment was an escape from lawful custody notwithstanding the judgment was thereafter vacated in appropriate legal proceedings. S. v. Goff, ante, 563, 142 S.E. 2d 142, decided June 2, 1965.
It is well established in this jurisdiction that a judgment imposing a sentence in excess of the legal limit (1) is void as to the excess and (2) erroneous as to the portion within the legal limit. If the time already served by the petitioner equals or exceeds the legal limit, the prisoner is entitled to his discharge in habeas corpus proceedings. S. v. Austin, supra. If not, the judgment must be vacated and the cause remanded for proper sentencing; and, when proper sentence is pronounced, the defendant is to be given credit for the time he served as a prisoner under sentence pronounced in the vacated judgment. S. v. Austin, supra; S. v. Templeton, 237 N.C. 440, 75 S.E. 2d 243; S. v. Miller, 237 N.C. 427, 75 S.E. 2d 242; In re Sellers, 234 N.C. 648, 68 S.E. 2d 308; S. v. Green, 85 N.C. 600. As stated by Barnhill, J. (later C. J.), in In re Sellers, supra: “The court below, in pronouncing sentence, should be careful to so condition its judgment as to allow petitioner credit for the time he has served in execution of the sentence hereby vacated.”
Decisions of this Court cited in the preceding paragraph appear to be in accord with the weight of authority. There are decisions contra, some of which turn upon whether the vacated judgment is considered void or erroneous. See Annotation, “Right to credit for time served under erroneous or void sentence or invalid judgment of conviction necessitating new trial.” 35 A..L.R. 2d 1283, particularly § 5, pp. 1288-1291.
In Lewis v. Commonwealth, 108 N.E. 2d 922, 35 A.L.R. 2d 1277 (Mass.), which is in accord with our decisions, Qua, C. J., said: “It is hardly realistic to say that nine months in the State prison amount to nothing — that since the petitioner ‘should not have been imprisoned as he was, he was not imprisoned at all.’ King v. United States, 69 App. D.C. 10, 98 F. 2d 291, 293-294. Moreover, since there is no statute of limitation affecting the filing of petitions for writs of error in criminal cases, G.S. (Ter. Ed.) c. 250, § 10, the time served before the reversal of the sentence might in some other case be so long that glaring and intolerable injustice would result if the time served on a first sentence should not be taken into account in imposing a second sentence. It is not even technically correct to say that the first sentence must now be deemed to have been a nullity. It was not a nullity when it was imposed or while it was being served. The court had jurisdiction over the crime of robbery and had jurisdiction over the defendant. The sentence was erroneous and voidable for error but was not void until reversed. (Citations.) ” (Our italics.)
*686Time served by defendant as a prisoner under the judgment pronounced at May 1963 Session and that served by him under the judgment pronounced at the December 1964 Session constitute punishment for the same conduct. Under S. v. Goff, ante, 563, 142 S.E. 2d 142, the judgment pronounced at May 1963 Session constituted a valid basis for prosecution for escape. It cannot be treated as a nullity in respect of time served as punishment for the conduct charged in the bill of indictment.
In S. v. Williams, supra; S. v. White, supra; S. v. Anderson, supra; and S. v. Slade, supra, the defendants’ original conviction (or plea) and the judgment pronounced thereon were vacated on application of the prisoner-defendant on account of a denial of constitutional rights.
It is noted that Anderson and Slade were decided on authority of Williams and White. In S. v. White, supra, it is stated: “Defendant having been convicted of the same offense on the second trial on the same indictment a heavier sentence may be imposed than was imposed on the first trial.” S. v. Williams, supra, and decisions from other jurisdictions, are cited in support of this statement. As to this proposition, the authority of the four cited cases is fully recognized.
In & v. Williams, supra, the per curiam opinion closes with these words: “Defendant’s contention that the judge was compelled to allow him credit for the period spent in prison before a valid trial was had is also without merit.” The fact that the second judgment imposed a maximum prison sentence was not stressed. In S„ v. White, supra, where the total of the second sentence and the time served under the vacated judgment was within the legal maximum, it was held that the defendant was not entitled as a matter of right to credit on the second sentence for the time he had served under the vacated judgment. It was stated: “There is nothing in the record to indicate whether or not Judge Latham in imposing sentence in the instant case gave or failed to give defendant credit for the time he had served under the original sentence in the first trial.”
Decision on this appeal does not necessitate reconsideration of the decision in White as applied to the factual situation considered therein or to the later decisions based thereon, to wit, Anderson and Slade. Here, defendant was punished from May 9, 1963 until September 25, 1964 by his service of a sentence for the felony charged in the bill of indictment, a crime of which he was subsequently acquitted. The fact that the judgment pronounced at December 1964 Session upon defendant’s conviction of an assault with a deadly weapon imposed the maximum two-year sentence dispels any suggestion that the trial judge gave defendant credit for the punishment he already had received for the conduct charged in the bill of indictment. The hard fact of his *687actual service of sentence from May 9, 1963 until September 25, 1964 cannot be ignored. At December 1964 Session, the maximum permissible sentence, inclusive of the time he had served for the same conduct under the sentence imposed by judgment pronounced at May 1963 Session, was a term of two years. Little v. Wainwright, 161 So. 2d 213 (Fla.), and cases cited.
S. v. Williams, supra, to the extent in conflict herewith, is overruled.
Defendant’s service of sentence from May 9, 1963 until September 25, 1964 must be considered service on the maximum two-year sentence pronounced at December 1964 Session. Moreover, since his service during this period is deemed an integral part of the two-year sentence, such service must be considered in determining defendant's gained time, if any, on account of good behavior. G.S. 148-13; In re Swink, 243 N.C. 86, 92, 89 S.E. 2d 792; Lewis v. Commonwealth, supra; Little v. Wainwright, supra.
While there is authority to the contrary, Tilghman v. Culver, 99 So. 2d 282 (Fla.), we are of opinion, and so hold, that defendant is not entitled as a matter of right to credit for the period from September 25, 1964 until the date of the judgment pronounced at December 1964 Session. During this period, while in custody in default of bond, defendant was not serving a sentence as punishment for the conduct charged in the bill of indictment.
The judgment of the court below should be and is modified by providing that, in accordance with this opinion, defendant is entitled as a matter of right to credit on the two-yéaí sentence imposed by judgment pronounced at December 1964 Session for the time he served as a prisoner, that is, from May 9, 1963 to September 25, 1964, under the (subsequently vacated) judgment pronounced at May 1963 Session. As so modified, the judgment of the court below is affirmed.
Modified and affirmed.