Opinion
WHITE, P. J.In this appeal we hold that a defendant who is in custody at a locked facility pursuant to a civil commitment of fixed duration is not entitled to presentence credit against a prison term where (1) the term
*1017arises from conduct unrelated to the civil commitment, and (2) the restraints associated with such conduct occur after the civil commitment order.
Defendant Rich C. Libhart appeals from the judgment of the Superior Court of Sonoma County following his plea of nolo contendere to a violation of Penal Code section 289, subdivision (a) (penetration by foreign object). Defendant’s sole contention on appeal is that the trial court erred in denying him presentence custody and conduct credit. We reject this contention and affirm the judgment.
Defendant was arrested in Sonoma County on July 8, 1984, for filing a false police report (Pen. Code, § 148.5) and on child molestation charges (Pen. Code, §§ 288, subd. (a), 289, subd. (a)). The former charge stemmed from his complaint that he had been assaulted when actually he had attempted suicide. After six days in custody he was given a supervised own recognizance release (OR) on the false police report charge and the molestation charges were dropped. Apparently on his own initiative, and unbeknownst to his probation officer, defendant went to San Francisco where, on July 20, he was admitted to the McAuley Institute of Saint Mary’s Hospital, a locked, residential treatment facility. On August 9, the San Francisco County Superior Court had him involuntarily committed to McAuley for 180 days pursuant to Welfare and Institutions Code section 5300.1
Sonoma County refiled the molestation charges on November 15. On November 20 he was arrested, taken to Sonoma County, and a day later *1018arraigned. The court ordered release on OR under the “same terms and conditions as the other case,” and he was to remain at McAuley. Following his preliminary hearing, defendant entered not guilty and not guilty by reason of insanity pleas. On June 19, 1985, he changed his plea to nolo contendere to a single count in exchange for dismissal of the remaining counts and an agreement the sentence would not exceed three years.
At sentencing, defendant contended that he was entitled to presentence credit from November 22, 1984, the day following the arraignment, to August 29, 1985, the day he was sentenced. The prosecution admitted credit was due for the time after January 20, 1985, when defendant’s 180-day commitment expired, but disputed his claim to credit for the November 22 to January 20 period on the ground that during this time defendant’s confinement was the result of a civil commitment arising from the false police report charge rather than the molestation charges. The court agreed, excluding this period from credit. In all, defendant was awarded 343 days of credit, 229 for time served and 114 days for good conduct.
The issue presented to this court is whether defendant’s confinement at McAuley for the period following his arraignment on the molestation charges was attributable to those charges within the meaning of Penal Code section 2900.5. That section reads in relevant part: “(a) In all felony and misdemeanor convictions, either by plea or by verdict, when the defendant has been in custody, including but not limited to any time spent in a . . . halfway house, rehabilitation facility, hospital ... or similar residential institution, all days of custody of the defendant, . . . shall be credited upon his term of imprisonment. . . . [¶] (b) For the purposes of this section, credit shall be given only where the custody to be credited is attributable to proceedings related to the same conduct for which the defendant has been convicted.
The Supreme Court has had occasion to define the parameters of subdivision (b)’s limiting language. In In re Rojas (1979) 23 Cal.3d 152 [151 Cal.Rptr. 649, 588 P.2d 789], an inmate serving time for manslaughter was charged with an unrelated murder and transferred to a county jail to await trial for the murder. Upon conviction he claimed presentence custody credit for the jail time against the murder sentence. The Supreme Court held that section 2900.5 does not authorize credit “for time spent in custody if during the same period he is already serving a term of incarceration.” (Id., at pp. 155-156.) The court explained that as to one already under sentence who is later charged with a second crime, “the deprivation of liberty for which he seeks credit cannot be attributed to the second offense. Section 2900.5 does not authorize credit where the pending proceeding has no effect whatever upon a defendant’s liberty.” (Id., at p. 156.)
*1019In the later case of In re Atiles (1983) 33 Cal.3d 805 [191 Cal.Rptr. 452, 662 P. 2d 910], a parolee was charged with robbery and sodomy and spent six months in jail before he was sentenced on the robbery. The issue was whether he was entitled to have the six months credited against the robbery sentence where his custody during this time was attributable not only to a parole hold arising from the robbery, but also the sodomy charge and a third parole violation. The Supreme Court held that even though petitioner’s presentence custody was attributable to restraints other than the robbery, he was entitled to credit since the robbery charge was one of the reasons he could not gain his liberty. The court interpreted subdivision (b) as follows: “In determining whether custody for which credit is sought under section 2900.5 is ‘attributable to proceedings leading to the conviction,’ the sentencing court is not required to eliminate all other possible bases for the defendant’s presentence incarceration. The court need only determine that the defendant was not already serving a term for an unrelated offense when restraints related to the new charge were imposed on him, and the conduct related to the new charge is a basis for those restraints.” (Id., at p. 810.)
While Atiles read section 2900.5 expansively, it nevertheless affirmed the rule in Rojas by excluding from credit “. . .a term for an unrelated offense [that predated] when restraints related to the new charge were imposed on him.” (In re Atiles, supra, 33 Cal.3d at p. 810.) In essence, the court held that except where the Rojas rule applies, a defendant should get credit against his sentence for his presentence custody if his custody was in any way attributable to the charge on which he was sentenced. The distinction between Rojas and Atiles is critical, for, as we explain, the facts of this case fall within the Rojas exception to the general rule in Atiles.
First, as in Rojas, defendant’s initial custody at McAuley2 did not result from the charges on which he was sentenced. His contact with McAuley apparently resulted from his own initiative. His original OR release conditions said nothing about confinement in a locked rehabilitation facility, only that he seek “psychiatric treatment as directed by the P.O.” This condition stemmed from the false police report charge, not the molestation charges. Defendant spent from July 20 to August 9 at McAuley before the San Francisco Superior Court committed him for 180 days pursuant to section 5300. The reason for the commitment is not disclosed by the record. However, tracking the statute’s language, we may conclude that defendant “attempted, inflicted, or made a serious threat of substantial physical harm *1020upon the person of another after having been taken into custody,” and was found to present “as a result of mental disorder or mental defect, a demonstrated danger of inflicting substantial physical harm upon others.” (Welf. & Inst. Code, § 5300, subds. (a), (b).) We may safely assume that at some point after June 20, defendant exhibited behavior which warranted extending his confinement for a 180-day period. It is certain, and defendant does not contend to the contrary, that the cause of defendant’s 180-day commitment was wholly unrelated to the molestation charges.
Second, defendant was already serving a term on the day of his arraignment. By this time, he had been committed to McAuley and undergoing treatment there for four months, with two months on the commitment order remaining. Defendant was already in custody pursuant to the San Francisco court order when the restraint associated with the molestation charge was imposed. Therefore the new restraint could not have had any “effect whatever upon a defendant’s liberty.” (In re Rojas, supra, 23 Cal.3d at p. 156.)3
We recognize that unlike the petitioner in Rojas, defendant was not “under sentence” or serving a “term of incarceration” when arraigned. However, we conclude that the logic of the rule in Rojas is equally applicable where the prior confinement results from a civil commitment order of fixed duration.4 The phrases “under sentence” and “of incarceration” were most likely intended to describe the facts in Rojas rather than as words of limitation. We find in Afiles support for this interpretation by that court’s omission of the words “under sentence” and “of imprisonment” in favor of the more general word “term”: “The court need only determine that the defendant was not already serving a term for an unrelated offense when restraints related to the new charge were imposed on him, . ...” (In re Atiles, supra, 33 Cal.3d at p. 810; see People v. Joyner (1984) 161 Cal.App.3d 364, 370 [207 Cal.Rptr. 636], White P. J., dissenting.)
Our application oí Rojas and Afiles is consistent with the Legislature’s intent, as evidenced by section 2900.5, subdivision (a), to equate, for purposes of credit, jail time with less traditional forms of custody such as *1021halfway houses and other rehabilitation facilities. Time spent in such facilities is considered “custody” in awarding presentence credit. By the same logic, a presentence commitment order for a fixed period at a rehabilitation facility should be equated with a presentence prison term, barring credit under Rojas and Afiles. (Cf. People v. Mercurio (1985) 169 Cal.App.3d 1108, 1112 [216 Cal.Rptr. 1].)5 Such a result furthers the principle that the status of the facility at which a defendant is confined should not be determinative of whether he is or is not entitled to presentence credit.
Most importantly, equating a civil commitment which shares the essential attributes of a prison sentence—confinement at a locked facility for a fixed period—furthers the rationale clearly expressed in Rojas that no credit should be allowed where the restraint “has no effect whatever upon a defendant’s liberty.” In this case, defendant’s commitment was for a fixed period of 180 days.6 He was already under San Francisco court order to remain at McAuley two more months at the time of arraignment. The Sonoma County OR order had no effect on his ability to gain release from custody at McAuley, nor did the court have power to alter the San Francisco court’s commitment order. For these reasons, we find the principle expressed in Rojas controlling, and therefore hold that defendant is not entitled to the presentence credit he seeks.7
Defendant’s contention that the denial of presentence credit violates equal protection also lacks merit. If the denial of credit had been on the basis that defendant suffered a civil rather than a criminal commitment prior to being sentenced, his claim might be persuasive. However, the distinction in this case is between presentence custody which is related to a later prison sentence and presentence custody which is not attributable to a later sentence within the meaning of section 2900.5. We find ample justification for such a distinction.
*1022Finally, we reject the assertion defendant is entitled to conduct credit under section 4019. We find no authority that conduct credit may be awarded for custody not attributable to the sentence against which credit is sought.
The judgment is affirmed.
Scott, J., and Merrill, J., concurred.
Appellant’s petition for review by the Supreme Court was denied February 11, 1987.
The statute reads: “At the expiration of the 14-day period of intensive treatment, a person may be confined for further treatment pursuant to the provisions of this article for an additional period, not to exceed 180 days if one of the following exists:
“(a) The person has attempted, inflicted, or made a serious threat of substantial physical harm upon the person of another after having been taken into custody, and while in custody, for evaluation and treatment, and who, as a result of mental disorder or mental defect, presents a demonstrated danger of inflicting substantial physical harm upon others.
“(b) The person had attempted, or inflicted physical harm upon the person of another, that act having resulted in his or her being taken into custody and who presents, as a result of mental disorder or mental defect, a demonstrated danger of inflicting substantial physical harm upon others.
“(c) The person had made a serious threat of substantial physical harm upon the person of another within seven days of being taken into custody, that threat having at least in part resulted in his or her being taken into custody, and the person presents, as a result of mental disorder or mental defect, a demonstrated danger of inflicting substantial physical harm upon others.
“Any commitment to a licensed health facility under this article places an affirmative obligation on the facility to provide treatment for the underlying causes of the person’s mental disorder.
“Amenability to treatment is not required for a finding that any person is a person as described in subdivisions (a), (b), or (c). Treatment programs need only be made available to these persons. Treatment does not mean that the treatment be successful or potentially successful, and it does not mean that the person must recognize his or her problem and willingly participate in the treatment program.”
We note that respondent does not dispute that McAuley is a “halfway house, rehabilitation center, hospital, ... or similar residential institution” within the meaning of section 2900.5, subdivision (a). Although the record does not disclose the exact nature of the Institute, other than it being a locked, residential facility, we have no doubt that confinement there falls within the rubric of “custody” as defined in subdivision (a).
Defendant argues it is incongruous that he should be awarded credit for time spent in a halfway house after his release from McAuley and before sentencing, yet be denied credit for his time at McAuley, which is a locked facility. The answer is simply that while at McAuley, he was serving a term within the meaning of Rojas, whereas his postcommitment custody was attributable to the molestation charge for which he was sentenced.
Defendant’s argument that because a civil commitment can be modified at any time (see Welf. & Inst. Code, § 5305), it should not be equated with a prison sentence, is unpersuasive. The mere possibility that a defendant can be released before his fixed term has expired does not undermine the rationale of our conclusion. There is always a remote likelihood of an inmate being pardoned by the Governor, yet this fact does not defeat the underlying logic of the Rojas decision.
In Mercurio, defendant was serving the end of her sentence in a halfway house when arrested on a new charge. She was removed to a jail where she remained until sentencing. The court properly denied her credit for the jail time during which her previous sentence was still in effect despite her argument that her conditions of confinement were more severe in jail. (Mercurio, supra, at p. 1113.)
That a commitment order under section 5300 results in a fixed term of custody is evidenced by the statute’s definition of custody as an “involuntary detainment . . . uninterrupted by any period of unconditional release from a licensed health facility providing involuntary care and treatment.” (Welf. & Inst. Code, § 5300.5, subd. (a).)
Having concluded defendant was serving a “term” before being arraigned on the molestation charges, we need not delve into the ambiguities of the record, as the parties have done, to determine whether custody was an implicit condition of the court’s OR order. Even assuming that when the court granted OR under the “same terms and conditions as on the other case,” it considered confinement at McAuley to be one of those conditions, this restraint had no effect on defendant’s liberty.