
520 P.2d 753 (1974)
Thomas F. LANGE, Petitioner-Appellee,
v.
Hilbert SCHAUER, Executive Director Department of Institutions and Fred Wyse, Warden, Colorado State Penitentiary, Respondents-Appellants.
No. 25689.
Supreme Court of Colorado, In Department.
April 1, 1974.
Rehearing Denied April 22, 1974.
*754 Frickey, Cairns & Wylder, P. C., Earl S. Wylder, Denver, for petitioner-appellee.
John P. Moore, Atty. Gen., John E. Bush, Deputy Atty. Gen., Richard G. McManus, Jr., Asst. Atty. Gen., Denver, for respondents-appellants.
LEE, Justice.
The petition of Thomas L. Lange, appellee, for a writ of habeas corpus was granted by the Denver district court, which ordered that he be unconditionally released from the state penitentiary where he was serving a sentence for a conviction of larceny of a motor vehicle. In this appeal the People challenge the validity of the order of discharge. We affirm in part and reverse in part.
Lange, who was on parole from a sentence in the state penitentiary arising out of a conviction of assault with a deadly weapon, committed the offense of larceny of a motor vehicle on June 21, 1965. His parole was revoked and he was sentenced to serve a term of not less than two nor more than six years in the penitentiary, to run consecutively to the term he was serving when placed on parole.
*755 After completing his assault sentence and having commenced serving his sentence for larceny, Lange escaped from the penitentiary honor farm on March 14, 1967. Approximately one month later he was arrested in Denver and charged in the Denver county court with joyriding. Upon his plea of not guilty by reason of insanity, the case was transferred to the Denver district court. There he was tried on the insanity issue and was found not guilty by reason of insanity. On April 15, 1967, he was ordered confined in the Colorado State Hospital.
A motion to correct sentence under Crim.P. 35(b) was filed, requesting that the district court, under its inherent supervisory power, order, first, that Lange be credited with the time during which he was confined in the state hospital on his prison sentence; second, that his "good time" earned prior to his escape be ordered reinstated; and, third, that the two-year ineligibility provision of the parole statute, C.R.S.1963, 39-18-7(2), be held not applicable to him upon his return to the penitentiary from the state hospital. He predicated his entitlement to this relief on his insanity at the time of his escape from custody. It was the opinion of the psychiatrist upon whose evaluation Lange was found to be legally insane and not accountable on the date of the joyriding offense, April 15, 1965, that he was also insane at the time of his escape from the penitentiary. Lange contended that he should not be held accountable for the escape and forfeitures resulting under the statutes as a consequence thereof. This motion was summarily denied without findings.
An administrative transfer was given Lange on February 1, 1971, from the state hospital back to the penitentiary so that he could resume serving his sentence, although he was not then physically returned to the penitentiary. On June 8, 1972, Lange was restored to competency and he was returned to the penitentiary on June 13, 1972.
A disciplinary hearing was held before the prison Administrative Adjustment Committee concerning Lange's escape. On June 19, 1972, the committee returned its findings in which, while it noted Lange's claim of insanity at the time of his escape, nonetheless found him to be responsible for his escape and subject to the statutory sanctions. No appeal was taken from this administrative determination.
It is the statutory scheme to grant prison inmates good-time credits for their conduct toward reduction of prison time to be served. C.R.S.1963, 105-4-4 and 105-4-7. As a corollary, good-time credits are forfeited for an escape or attempt to escape, as well as for other misbehavior. C.R.S. 105-4-6 and 105-4-8. An additional sanction is imposed for escape by the parole statute, C.R.S.1963, 39-18-7(2), which provides:
"(2) No prisoner confined in the state prison and no prisoner under sentence to the state prison who has escaped or attempted to escape from the prison or the guards may be paroled or discharged until he has served at least two calendar years from and after the date of his return to the prison, whether such two years extend beyond his maximum sentence or not, and during such two years such prisoner shall not be credited with any good time whatsoever."
Lange's habeas corpus petition alleged substantially the same grounds for release as his earlier motion under Crim.P. 35(b). Although the court did not make findings when it denied the 35(b) motion, it is apparent that the motion was premature in that Lange was then confined in the state hospital under a valid insanity commitment and the sanctions for escape that might be imposed under the statutes had not yet been determined by the prison administration. Under these circumstances, we do not regard the prior 35(b) motion as barring the habeas corpus proceeding, as is suggested by the People.
At the conclusion of the habeas corpus hearing, the trial court determined that *756 Lange was legally insane at the time of his escape from the prison honor farm and that he should not be held accountable. It ordered that he be given credit for the good time earned prior to his escape, for the time he was confined in the state hospital under the insanity commitment, and for good time earned after his return to the prison.
The record supports the court's finding that Lange was insane at the time of his escape. We agree with the court's conclusion that Lange should not be held accountable for his escape so as to forfeit good time earned prior thereto, or be held subject to the sanctions of section 39-18-7(2) by which he was ordered by the Administrative Adjustment Committee to serve at least two calendar years from and after his administrative transfer to the prison, without the opportunity to earn good time during this two-year period. It would be an anomaly under the circumstances of this case that Lange, by reason of his legal insanity and unaccountability, could not have been convicted of a felonious escape under C.R.S.1963, 40-7-53, whereas he could be held accountable for his escape and be subject to the statutory sanctions resulting therefrom, in spite of his insanity and unaccountability. Cf. Schwickrath v. People, 159 Colo. 390, 411 P.2d 961. In these circumstances the action of the Administrative Adjustment Committee in failing to consider Lange's evidence of insanity at the time of his escape was arbitrary and capricious. Cf. Evans v. Moseley, 455 F. 2d 1084 (10th Cir. 1972).
We affirm the court's determination that Lange's prior good time should have been reinstated and that he should not have been declared ineligible, under section 39-18-7(2), to earn good time for a period of two years after his return to prison.
We find, however, that the court erred in determining that Lange should have been given credit on his sentence for the time he was confined in the state hospital. This commitment was properly ordered as a result of a judgment of legal insanity arising out of a totally separate criminal charge. The purpose of the confinement was for mental rehabilitation and not for punishment. The length of the confinement was dependent upon the success of the treatment of the patient, Lange. In short, the confinement was totally independent of the criminal transaction for which he had previously been sentenced.
C.R.S.1963, 105-4-18 provides that unless otherwise pardoned or released by legal authority a convict cannot be discharged from the penitentiary until he has remained the full term for which he was sentenced (subject to reduction for good time), excluding, however, any time the prisoner may have been at large by reason of escape. This means the prisoner must serve his sentence in the penitentiary, or in such other penal institution to which he may be legally transferred or ordered confined. When Lange was confined in the state hospital as a result of a totally unrelated transaction which occurred during a period of escape, he was not serving his sentence and was not entitled to credit for the time of such confinement.
Accordingly, we reverse the judgment of the court that Lange be given credit on his criminal sentence for the time he spent in confinement at the Colorado State Hospital under the insanity judgment in the joyriding case.
The judgment is affirmed in part and reversed in part, and the cause remanded to the district court for further proceedings consonant with the views expressed herein.
HODGES, KELLEY and GROVES, JJ., concur.
