On August 10, 1944, petitioner pleaded guilty to first-degree murder in the circuit court for Forest county. He was sentenced to life imprisonment. In November, 1964, this court vacated his conviction and sentence and remanded him to the custody of the sheriff for further proceedings. 1
A preliminary examination was thereafter had. Petitioner was bound over to the circuit court, where he pleaded guilty to second-degree murder.
The judgment provided for a sentence of not less than fourteen years and not more than twenty-five years.
The trial court applied the provisions of sec. 958.06, Stats. A part of the oral pronouncement of the trial court is as follows :
“It is the judgment and sentence of this court that you be punished by imprisonment in the state’s prison at Waupun at hard labor for a general indeterminate term of not less than 14 years and not more than 25 years.
“It is the further order of the court that under the provisions of sec. 958.06 of the Wisconsin Statutes the defendant is now having a new trial and has had a new trial and shall be sentenced as though the original trial upon which he entered a plea of guilty was a trial and this occasion upon which he enters a plea of guilty is also a trial, and this being a new trial which resulted in conviction of the defendant.
“It is the further order of the court that allowance shall be made and there shall be deducted from the maximum sentence *173here imposed the time of imprisonment that the defendant has served by reason of the conviction on August 10, 1944, so that on no account may the aggregate term exceed the maximum term of 25 years provided by the statute.
“The effect of this sentence is that the defendant shall not be required to serve more than the aggregate of 25 years and that there shall be deducted from said maximum sentence the twenty years, six months, twenty-six days — in other words, it is the intention of the court that he be given the maximum benefit of the time previously served.”
Petitioner now asserts that his period of confinement has expired, when allowance is made for the twenty years he has spent in prison, together with the good time earned as though he had originally been sentenced to prison for twenty-five years, as ordered by the trial court. Respondent admits in his return that if petitioner is entitled to credit for time served, plus good time earned, he should be discharged. Eastman is entitled to such credits.2 Proceedings for new trial in criminal cases are governed by sec. 958.06 (3), Stats., which provides:
“(a) A new trial shall proceed in all respects as if there had been no former trial. On the new trial the defendant may be convicted of any crime charged in the indictment or information irrespective of the verdict or finding on the former trial. The former verdict or finding shall not be used or referred to on the new trial.
“(b) If the new trial results in the conviction of the defendant, the trial court shall make allowance for and deduct from sentence imposed whatever time of imprisonment the defendant has served by reason of the acts constituting the offense with which he is charged, so that upon no account may the aggregate term exceed the maximum term provided by the statutes therefor.
*174“(c) If a defendant is convicted following a new trial and is sentenced to a term of confinement, any time served in prison under the earlier sentence for the same offense shall be counted as time served in establishing eligibility for parole under s. 57.06 (1) (a).”
Sub. (3) of sec. 958.06, Stats., modifies our decision in State ex rel. Drankovich v. Murphy (1946), 248 Wis. 433, 22 N. W. (2d) 540. In that case petitioner pleaded guilty to first-degree murder. The conviction on his petition for writ of habeas corpus was set aside. We said that if petitioner is retried on the same information the trial court would have no alternative but to sentence him to life imprisonment, although petitioner had already served eleven years. We concluded, at page 440:
“The trial court upon resentence could not take the fact of his eleven years’ imprisonment into consideration. The petitioner then would have to commence another life sentence.”
Two attorney general’s opinions bear mention. In 31 Op. Atty. Gen. (1942), 3, the defendant was sentenced to a term of from one year to ten years on December 4, 1940. He was received at the prison on December 15, 1940. One year later the trial court ordered him returned for a new trial, which was had on December 20, 1941. Defendant was returned to prison following the new trial. His sentence provided that he was entitled “ ‘to have credit of one year on said sentence for time already served.’ ”
The attorney general ruled that the prisoner was not entitled to credit for the time already served, citing sec. 359.07, Stats, (now sec. 959.07) and 27 Op. Atty. Gen. (1938), 329.3
The opinion was that commencement and end of a sentence are not part of the sentence, nor any concern of the trial *175court. Further, the sentence begins at noon when the prisoner is actually received at the penal institution. The effect of the statute is to preclude consideration of prior sentences.
The rule in the Drankovich Case, supra, and the two attorney general’s opinions was concisely stated in Lewis v. Commonwealth (1952), 329 Mass. 445, 450, 108 N. E. (2d) 922:
“Where the error occurs in the proceedings before sentence and necessitates a new trial and not merely a resentence, it seems to be rather generally understood that time served under the sentence which is invalidated need not as matter of law be considered in imposing the second sentence, the reason given being that in seeking a new trial the defendant must be deemed to have consented to a wiping out of all the consequences of the first trial.” 4
See also Anno. 35 A. L. R. (2d) 1283, Right to credit for time served under erroneous or void sentence or invalid judgment of conviction necessitating new trial. It is there said, at page 1285 :
“The courts generally seem to agree that, absent a 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 against the second sentence time served under the original sentence.”
We conclude that sub. (3) of sec. 958.06, Stats., was designed to revise the rule of the foregoing authorities so a defendant upon a redetermination of guilt shall receive allowance for whatever time of imprisonment he has served by reason of the acts constituting the offense with which he is *176charged. However, the use of the words “new trial” in this subsection has caused us difficulty because of Pulaski v. State (1964), 23 Wis. (2d) 138, 126 N. W. (2d) 625. There we held that a motion for new trial under subs. (1) and (2) of sec. 958.06 will not lie where there has been a conviction on a plea of guilty, and we said (p. 142):
“The state contends such a motion for a new trial is not proper because there has been no trial within the meaning of the section and therefore there can be no new trial. In Belter v. State (1922), 178 Wis. 57, 189 N. W. 270, it was stated a plea of guilty was a waiver of any trial. Certainly the plea avoids a contest of disputed facts the same as a confession of judgment or the failure to answer in a civil action. A court is permitted to receive a plea of guilty and to enter a judgment thereon under sec. 957.25, Stats., and a conviction may rest upon a plea of guilty without any supporting testimony being taken. Sec. 959.01. A trial is defined as a judicial examination of the issues between the parties whether they be issues of law or of fact. Sec. 270.06; see also 88 C. J. S., Trial, p. 19, sec. 1. We must agree the new trial contemplated by sec. 958.06 is a retrial of issues and the section affords no remedy for one convicted on his plea of guilty.”
The words “new trial” may mean different things in different contexts.5 We construe “new trial” as used in sub. *177(3) of sec. 958.06, Stats., as encompassing redetermination of guilt irrespective of whether the original or subsequent determination was made on a plea of guilty. Any other conclusion by us would not give full effect to the limitation on Drankovich which the legislature obviously sought to accomplish by enactment of sec. 958.06 (3).6
No substantial reason exists to justify different results as to sentence imposed merely because a defendant has pleaded guilty rather than not guilty. •
The purpose of criminal law is to see that persons accused of crimes shall be properly and fairly convicted. There must be no substantial impediment of this objective. We think such an impediment existed under our former Drankovich rule wherein a convicted person was deemed to have waived time previously served when he challenged the conviction and received a new trial. We deem a rule unfair and unjust which requires a person to serve time in excess of that provided for in a valid conviction and sentence for the same criminal act.
*178We feel compelled to note that we do not approve of the opinions of the attorney general in 27 Op. Atty. Gen. (1938), 329 and 31 Op. Atty. Gen. (1942), 3, to the effect that the state department of public welfare may disregard as mere surplusage a direction of the sentencing court that the defendant be given credit for time previously served for the same offense.
In this instance the sentence imposed was not less than fourteen years and not more than twenty-five years. These limitations were the minimum and maximum as provided by sec. 340.08, Stats. 1943. Can it be said that the trial court in performing its judicial function did not take into consideration the fact that credit for time served was to be given to the defendant in fixing the maximum of twenty-five years? We think not. Even if the direction and order of the trial court as to credit for time served was erroneous, it was not void 7 and the state department of public welfare may not disregard it. The state, and its agent, the department, should be left with the same remedies as any other litigant, namely rehearing at the trial court, or writ of error.
As noted earlier an inmate who has served his sentence, less good time earned is entitled to a conditional release. However, this provision of ch. 53 applies only to inmates convicted of crimes committed after May 27, 1951. See sec. 53.11 (7), Stats. Prior to that date an inmate who had served his sentence less good time was entitled to an unconditional release. Likewise an inmate who has now served his sentence for a crime committed prior to May 27, 1951, less good time, is entitled to an unconditional release.
*179By the Court. — The petitioner having had a hearing such as he would have had, had the writ of habeas corpus been issued, it is considered that the issuance of the writ be omitted, and it is adjudged that petitioner is entitled to his release and discharge from Wisconsin state prison and the state department of public welfare and the warden are directed to release the petitioner.