
144 N.W.2d 438 (1966)
180 Neb. 631
STATE of Nebraska, Appellee,
v.
David KING, Appellant.
No. 36138.
Supreme Court of Nebraska.
July 22, 1966.
*439 William L. Walker, Lincoln, for appellant.
Clarence A. H. Meyer, Atty. Gen., Harold Mosher, Asst. Atty. Gen., Lincoln, for appellee.
Heard before CARTER, SPENCER, BOSLAUGH, BROWER, SMITH, and McCOWN, JJ., and COLWELL, District Judge.
CARTER, Justice.
On April 2, 1959, defendant was charged in the district court for Douglas County with the crime of robbery. On September 25, 1959, defendant entered his plea of guilty and was sentenced to an 8-year term in the Nebraska State Penitentiary. On December 30, 1964, the United States District Court held in a habeas corpus proceeding that the conviction and sentence was void but stayed defendant's release on the writ until the proper authorities could institute a new criminal proceeding against the defendant. Defendant was again tried in the district court for Douglas County on March 16 to 18, 1965, and a verdict of guilty was returned by the jury. Defendant was sentenced on April 13, 1965, to serve 4 years confinement at hard labor in the Nebraska Penal and Correctional Complex in Lancaster County, Nebraska. The defendant appealed to this court.
Defendant was represented by legal counsel in the district court in the person of Michael Levy. After assisting in the trial, Mr. Levy disassociated himself from the case. Before the final submission of the case on appeal, this court directed the appointment of an attorney at state expense by its opinion in State v. King, 179 Neb. 511, 138 N.W.2d 805. Pursuant thereto William L. Walker was appointed as legal counsel to handle defendant's appeal in this court.
The defendant has asserted 10 assignments of error, and those that are discussed in the brief are directed at the failure of the trial court to credit the time served under the void sentence on the sentence imposed on April 13, 1965. The void sentence was 8 years on which defendant had served 5 years and 3 months and with the 4-year sentence of September 13, 1965, the defendant could, as defendant alleges, be required to actually serve more than 9 years.
Defendant relies on what he terms the modern rule set out in Freeman v. State, 87 Idaho 170, 392 P.2d 542. The rule cited in that case is: "In cases dealing with resentencing necessitated by the invalidity of the original sentence, but not involving a new trial between the first and second sentence, the courts are not in agreement on the question whether time served under the first sentence is to be credited against time served under the second. In some jurisdictions, allowance of such credit is provided for by statute. In jurisdictions lacking such a statute, what appears to be the modern (and, it is submitted, the better) view is that such an allowance is proper." Cases from many jurisdictions are cited in support of this rule. The foregoing rule relates to situations where the conviction was valid and the sentence itself was erroneous. It does not involve the precise question we have before us. We have before us the situation where the conviction and sentence were void and the new sentence resulted from a new trial of the case which intervened between the two sentences.
Defendant does cite cases from other jurisdictions which hold that time served on a void sentence should be credited on a subsequent *440 sentence on a valid conviction for the same offense. See, Stonebreaker v. Smyth, 187 Va. 250, 46 S.E.2d 406; Lewis v. Commonwealth, 329 Mass. 445, 108 N.E. 2d 922, 35 A.L.R.2d 1277; Short v. United States, 4 Cir., 344 F.2d 550.
The general rule is that in the absence of statute to the contrary, if a judgment of conviction is reversed at a time when the defendant is serving the sentence imposed, and, following a new trial and a second conviction, a new sentence is imposed, the defendant is not entitled to credit as a matter of right against the second sentence for the time served under the original sentence. See cases collected in 35 A.L.R.2d 1283, section 3 of the annotation there beginning. See, also, Robinson v. United States, 6 Cir., 144 F.2d 392; Palumbo v. State of New Jersey, 3 Cir., 334 F.2d 524; Shupe v. Sigler, 8 Cir., 230 F.Supp. 601; McCleary v. Hudspeth, 10 Cir., 124 F.2d 445.
The foregoing rule appears to have been the law of this jurisdiction for many years. McCormick v. State, 71 Neb. 505, 99 N.W. 237; Knothe v. State, 115 Neb. 119, 211 N.W. 619; Crommett v. State, 115 Neb. 399, 213 N.W. 743; In re Application of Cole, 103 Neb. 802, 174 N.W. 509, 848.
We adhere to the rule that where a conviction and sentence are held void and on a subsequent trial a new sentence is imposed, defendant is not entitled to credit as a matter of law on the second sentence for the time served under the original void conviction and sentence. The only question before the court in such a situation is whether or not the trial court abused its discretion in imposing the sentence that it did. The trial court may take into consideration the fact that the defendant has been confined under a void sentence just as it may take into consideration the length of time that a defendant has been confined while awaiting trial. It is evident that the trial court in the instant case did give consideration to the fact of defendant's confinement under the void sentence in that it first imposed a sentence of 8 years under the void conviction and a sentence of but 4 years under the subsequent valid conviction. The crediting of time in such a situation is a matter of sound judicial discretion on the part of the sentencing court with which this court will not interfere in the absence of a showing that such discretion was abused by the sentencing court.
A material distinction exists when time has been served under a valid conviction but under an erroneous or void sentence than in the case where the conviction is void and a subsequent conviction obtained. In the latter case the trial court, within the limits provided by statute, may exercise its sound judicial discretion in imposing sentence, including the consideration of all mitigating circumstances. But in such a case the defendant has no assurance, and is entitled to none as a matter of law, that he has everything to gain and nothing to lose. In Shupe v. Sigler, supra, this was pointed out in the court's opinion as follows: "In conclusion, it should be pointed out to Mr. Shupe and the many others who are filing petitions for a writ of habeas corpus in this court, that it is possible that some may be doing themselves more harm than good. They may not have `nothing to lose and everything to gain' in filing for the `great writ.' * * For many the bright rainbow and the hopes engendered by Fay v. Noia, and the other habeas corpus cases recently decided by the United States Supreme Court, may turn out to be an illusory rainbow with only a `pot of fool's gold' for its seeker."
The sentence is within the limits of the statute fixing the penalty for the crime of robbery. We find nothing indicating an abuse of discretion by the trial court in imposing the sentence of 4 years. There is no error in the record and the judgment of the district court is affirmed.
Affirmed.
