
71 Cal.2d 117 (1969)
In re GEORGE WILLIAM BENNETT on Habeas Corpus.
Crim. No. 12972. 
Supreme Court of California. In Bank.  
May 14, 1969.
 Lionel K. Hvolboll, under appointment by the Supreme Court, for Petitioner.
 Thomas C. Lynch, Attorney General, Doris H. Maier, Assistant Attorney General, Edward A. Hinz, Jr., John Fourt and Edsel W. Haws, Deputy Attorneys General, for Respondent.
 TRAYNOR, C. J.
 Petitioner, an inmate of Folsom State Prison, seeks a writ of habeas corpus on the ground that the Adult Authority unlawfully revoked his parole and denied him credit on his prison term for the time he spent in Atascadero State Hospital under commitment orders of the Los Angeles Superior Court.
 On December 29, 1958, petitioner was sentenced to imprisonment in the state prison for the term prescribed by law for a violation of Penal Code section 487.2 (grand theft from the person of another). On January 8, 1959, he began serving his sentence, which had a 10-year maximum. (Pen. Code,  489 and 2900.)petitioner was paroled in 1960, but in 1961 this parole was revoked, and his term was refixed at the maximum. In July 1962, the Adult Authority tentatively fixed his term at six and one- half years with parole for two and one-half years and set July 9, 1965 as the new discharge date. On January 9, 1963, petitioner was released on parole.
 In May 1963 an information charged petitioner with violations of Penal Code sections 207 and 288a. In July 1963 the Los Angeles Superior Court found him to be presently insane and committed him to Atascadero State Hospital for care and treatment. (Pen. Code,  1370-1372.)
 In August 1963 the Adult Authority cancelled petitioner's *119 parole and ordered his return to prison on the basis of a parole report specifying three violations of petitioner's conditions of parole as cause for this action: (1) petitioner changed his residence in March 1963 without permission of his parole agent, (2) petitioner failed to submit monthly reports since March 1963, and (3) petitioner violated Penal Code sections 207 and 288a.
 Petitioner remained at Atascadero until January 1966, when it was determined that he had sufficiently recovered his sanity to stand trial. He was then returned to the superior court. After a trial he was found not guilty by reason of insanity. The court determined that he had not fully recovered his sanity and recommitted him to Atascadero pursuant to Penal Code section 1026. On October 31, 1967, the superior court found petitioner to be then sane and ordered his release.
 On November 8, 1967, petitioner was taken into custody by the Adult Authority. A new parole report charged petitioner with the 1963 violations and with changing his residence upon his release by the superior court from Atascadero to Los Angeles without permission of his parole agent. The report stated that petitioner was presently sane but that the Atascadero authorities considered him still extremely dangerous. The report "recommended that he be returned to prison at this time, for the protection of society." The Adult Authority arrived at a new date of discharge, March 30, 1973, by adding to the maximum sentence the four years, three months and twenty-one days between the cancellation of petitioner's parole in 1963 and his return to the custody of the Adult Authority. On January 26, 1968, petitioner pleaded guilty to the parole violation charges, and after a hearing the Adult Authority revoked his parole.
 Petitioner contends that since a person is not criminally responsible for his acts while insane (Pen. Code,  26, subd. Three), conduct of an insane parolee that violates the conditions of his parole cannot constitute cause for revocation of parole. (See Pen. Code,  3063.) Since he was insane when he violated the conditions of his parole in 1963, he concludes that his parole was illegally revoked for these violations and that his term for the 1958 grand theft conviction therefore expired on July 9, 1965, as fixed by the Adult Authority in 1962. We cannot accept this conclusion.
 [1] Although the Adult Authority's 1963 order cancelling petitioner's parole was preliminary in nature, it was effective to refix petitioner's term at maximum, for it was based on a *120 reasonable belief that good cause existed for that action. (In re Brown (1967) 67 Cal.2d 339, 341-342 [62 Cal.Rptr. 6, 431 P.2d 630].) As in the Brown case, the Adult Authority's action was proper to protect its jurisdiction pending disposition of the criminal charges. The order continued in effect until the Adult Authority issued a final order revoking petitioner's parole in 1967. [2] While the preliminary order was in effect the Adult Authority issued another report that reviewed the prior charges, reaffirmed its 1963 order, added another charge, and discussed petitioner's subsequent history. This report stated that when petitioner was released from Atascadero, the medical authorities considered him sane but extremely dangerous, and the report recommended his return to prison for the protection of society. Because the Adult Authority has power to revoke parole when the presence of a parolee at large in the community may entail danger to society, this recommendation, supported by medical evidence, was sufficient cause for the revocation of petitioner's parole.
 The question remains whether the Adult Authority erred in denying petitioner credit for the time he spent at Atascadero pursuant to commitment orders of the superior court.
 Penal Code section 3064 provides: "From and after the suspension or revocation of the parole of any prisoner and until his return to custody he shall be deemed an escape and fugitive from justice and no part of the time during which he is an escape and fugitive from justice shall be part of his term." We thus confront the question: Has a person who has been committed to the custody of the medical authorities at Atascadero by orders of the superior court pursuant to Penal Code sections 1026 and 1367-1372 been returned to custody within the meaning of Penal Code section 3064?
 An insane prisoner may be transferred to the custody of the Department of Mental Hygiene by the Director of Corrections with the approval of the Adult Authority if the Director of Corrections believes that the prisoner's rehabilitation may be expedited by treatment at a state mental hospital. (Pen. Code,  2684.) Atascadero is an institution under the jurisdiction of the Department of Mental Hygiene. (Welf. & Inst. Code,  4001, 4100.)penal Code section 2685 provides that "... The time passed at the state hospital [pursuant to section 2684] shall count as part of the prisoner's sentence." The Attorney General contends that since Penal Code sections 1026 and 1367- 1375 contain no similar provisions for credit on a preexisting sentence for time spent in a state hospital, a *121 prisoner on parole committed under those sections has not been returned to custody within the meaning of Penal Code section 3064. We do not agree.
 [3] Section 2685 states a legislative policy that insane prisoners receive credit on their terms while undergoing treatment in state hospitals. It does not follow because that section specifically provides for credit when a prisoner is transferred to a state hospital by the Director of Corrections that the Legislature meant to deny credit when a court commits a prisoner on parole to a state hospital. [4] Under section 3064 credit is denied only to "an escape and fugitive from justice." A prisoner on parole who has been committed to a state hospital under section 1026 or sections 1367-1375 has certainly been returned to custody and is not "an escape and fugitive from justice" within the meaning of section 3064. (See In re Fluery (1967) 67 Cal.2d 600, 603 [63 Cal.Rptr. 298, 432 P.2d 986]; In re Patton (1964) 225 Cal.App.2d 83, 90 [36 Cal.Rptr. 864].)
 To deny credit for commitments under those sections would open the door to arbitrary discriminations involving insane prisoners on parole. For example, if the prosecuting attorney decided not to prosecute a parolee for committing a criminal act, the Adult Authority revoked his parole, and the Department of Corrections transferred him to a state hospital, Penal Code section 2685 would operate to give him credit for time spent in the state hospital. On the other hand, if the prosecuting attorney brought the parolee into court before the Adult Authority returned him to its custody, he would not receive credit for time spent in the same state hospital pursuant to a court order. Thus, the effect of denying credit in the latter situation would allow the prosecuting attorney to determine that the term of a parolee who commits a criminal act should be extended. The prosecuting attorney's function is to determine, not whether the term of such a parolee should be extended, but whether the parolee should be prosecuted for the criminal act.
 The purpose of a commitment to a state hospital is to rehabilitate and restore the sanity of the insane prisoner. The treatment devoted thereto will presumably be the same regardless of which code provision underlies the prisoner's presence in the hospital. [5] The fact that he is committed to a state hospital by court order rather than transferred there by the Director of Corrections affords no rational basis for evading the policy of section 2685 that prisoners receive *122 credit on their terms while undergoing treatment in state hospitals.
 In re Yutze (1968) 69 Cal.2d 389 [71 Cal.Rptr. 673, 445 P.2d 289], and In re Gullatt (1968) 69 Cal.2d 395 [71 Cal.Rptr. 676, 445 P.2d 292], are not contrary to our decision herein. In those cases, a state parolee was convicted in a federal court and sentenced to serve time in a federal institution. In each case, he sought a determination that time so served should be credited on his state term. We held that custody under section 3064 does not include confinement in a federal institution under sentence imposed upon judgment of conviction in a federal court, on the ground that by designating where such a sentence shall be served the Attorney General of the United States determines whether federal and state sentences run consecutively or concurrently. (See also, In re Campbell (1939) 36 Cal.App.2d 221 [97 P.2d 482].) Accordingly, neither case has any bearing on the meaning of section 3064 as it applies to confinement pursuant to an order of a court of this state in a state hospital in which a California prisoner may serve his sentence.
 Finally, we note as we did in In re Bevill (1968) 68 Cal.2d 854, 863 [69 Cal.Rptr. 599, 442 P.2d 679], "It is unnecessary to state, of course, that nothing we decide here precludes the initiation of civil commitment proceedings under any appropriate statute."
 With credit for the time spent in Atascadero State Hospital following the cancellation of his parole, petitioner's maximum term expired in January 1969. The writ is therefore granted and petitioner is discharged from custody.
 McComb, J., Peters, J., Tobriner, J., Mosk, J., Burke, J., and Sullivan, J., concurred.
