
50 Cal.App.3d 155 (1975)
123 Cal. Rptr. 268
In re CARROLL WAYNE JORDAN on Habeas Corpus.
Docket No. 14067.
Court of Appeals of California, First District, Division Four.
July 28, 1975.
*156 COUNSEL
Carroll Wayne Jordan, in pro. per., for Petitioner.
Evelle J. Younger, Attorney General, Jack R. Winkler, Chief Assistant Attorney General, Edward P. O'Brien, Assistant Attorney General, William D. Stein and Morris Lenk, Deputy Attorneys General, for Respondent.
OPINION
CALDECOTT, P.J.
Petitioner Carroll Wayne Jordan is presently incarcerated at Susanville pursuant to a judgment of the Amador County Superior Court convicting him of possession of stolen property (Pen. Code, § 496).
Petitioner was arrested in July 1972 by United States Treasury Department agents from the Bureau of Alcohol, Tobacco and Firearms, while he was in the process of stealing a quantity of explosives in Amador County, California. He was charged with the violation of title 18 of the United States Code, section 842(h) ("receive, conceal, transport ... [etc.] any explosive materials knowing [they] were stolen") and title 18 of the United States Code, section 924(c)(2) (carrying a firearm in the commission of a felony). Thereafter, he was committed to the Medical Center for Federal Prisoners in Springfield, Missouri, pursuant to title 18 *157 of the United States Code, section 4244, upon his motion for a medical examination to determine whether he was competent to stand trial. He remained in federal custody until charges against him were dismissed on August 27, 1974. He was then taken into the custody of California. On November 8, 1974, he pleaded guilty to a charge of receiving stolen property and was sentenced to state prison. He states that at the time he was sentenced, his attorney requested credit for the two years' time he served in federal custody; this request was denied.
Petitioner contends that since he served his federal time for the same acts for which he now stands convicted in state court, he is entitled to two years' credit on his state sentence. Penal Code section 2900.5 provides: "(a) In all felony convictions, either by plea or by verdict, when the defendant has been in custody in any city, county, or city and county jail, all days of custody of the defendant from the date of arrest to the date on which the serving of the sentence imposed commences ... shall be credited upon his sentence.... (b) For the purposes of this section, credit shall be given only where the custody to be credited is attributable to charges arising from the same criminal act or acts for which the defendant has been convicted." (Italics added.)
In the case of In re Miller, 41 Cal. App.3d 1046 [116 Cal. Rptr. 624], Miller was arrested on a robbery charge by state officers. A federal detainer was then filed, and Miller was ordered to be transferred to El Paso, Texas, to answer pending federal charges for assaulting a federal officer, spending a total of 23 days in federal custody.
The court noted that the federal proceedings were "wholly unrelated" to the Los Angeles robbery charge, and therefore, concluded the time spent in federal custody was not attributable to the state charge.
(1) In petitioner's case, however, his time spent in federal custody was directly related to the state charge, since it was one act which constituted both a state and federal offense.
The language of section 2900.5, subdivision (a) certainly does not, on its face, require that this court allow Jordan his two-year credit, since that section states that credit shall be given when the defendant has been in custody in any "city, county, or city and county jail." As we stated in In re Young, 32 Cal. App.3d 68 at page 75 [107 Cal. Rptr. 915], however: "Although the presentence jail time may not be `punishment' as defined by the Penal Code, it is a deprivation of liberty. The additional *158 deprivation suffered only by the indigent does not meet federal standards of equal protection and does not comply with the mandate of uniform operation of all general laws contained in article I, section 11 of the California Constitution. The enactment of Penal Code section 2900.5 is evidence that the disparate result does not further a compelling governmental interest that is served by classification."
In the instant case, petitioner was charged with a federal offense and then committed to the Medical Center for Federal Prisoners to determine whether he was competent to stand trial. Though we do not have here an unconstitutional discrimination based on indigency, we do have a defendant who was deprived of his liberty for a period of two years because of a circumstance (incompetency) beyond his control. This can operate to create an unconstitutional discrimination fully as serious to the alleged incompetent as exists in Young with reference to an indigent. In the light of Young we find no reason why the equal protection clause should not apply to the petitioner so that he will receive credit for the time spent in federal custody.
Despite the provisions of Penal Code section 2900.5, subdivision (c) that the section apply only prospectively, the Supreme Court has held that this limitation violates article I, sections 11 and 21 of the California Constitution, and the equal protection clause of the Fourteenth Amendment, and thus, the statutory benefits of the section are retroactive.
The petition for writ of habeas corpus is granted and the petitioner is to receive credit for the time confined in the Medical Center for Federal Prisoners in Springfield, Missouri.
The petition for writ of habeas corpus is granted and the petitioner is to receive credit for all time spent in federal custody which is attributable to the charge arising from the same criminal act for which petitioner has been convicted.
Rattigan, J., and Emerson, J.,[*] concurred.
A petition for a rehearing was denied September 25, 1975, and on August 27, 1975, the opinion and the judgment were modified to read as printed above. Respondent's petition for a hearing by the Supreme Court was denied October 23, 1975.
NOTES
[*]   Retired judge of the superior court sitting under assignment by the Chairman of the Judicial Council.
