
    Peter Emmanuel BERNARD, Petitioner-Appellant, v. David A. GARRAGHTY, Warden, N.C.C.; Attorney General of the Commonwealth of Virginia; Robert H. Anderson, III, Assistant Attorney General, Respondents-Appellees.
    No. 89-6022.
    United States Court of Appeals, Fourth Circuit.
    Argued March 7, 1991.
    Decided May 28, 1991.
    
      Mark Seifert, Third-Year Law Student, Post-Conviction Assistance Project, Harold J. Krent, argued (Jody S. Kraus, University of Virginia School of Law, Charlottesville, Va., on brief), for petitioner-appellant.
    Robert H. Anderson, III, Asst. Atty. Gen., argued (Mary Sue Terry, Atty. Gen. of Virginia, Richmond, Va., on brief), for respondents-appellees.
    Before ERVIN, Chief Judge, PHILLIPS, Circuit Judge, and BRITT, United States District Judge for the Eastern District of North Carolina, sitting by designation.
   ERVIN, Chief Judge:

This appeal raises the issue of whether a prisoner serving the second of two consecutive state sentences is “in custody” for purposes of bringing a federal habeas corpus challenge against the first sentence already served. The Supreme Court in Peyton v. Rowe, 391 U.S. 54, 88 S.Ct. 1549, 20 L.Ed.2d 426 (1968), has decided this issue for us. Therefore, we reverse the magistrate judge’s dismissal of the prisoner’s petition for habeas corpus relief, and we remand for proceedings consistent with this opinion.

I.

On October 24, 1983, Peter Bernard was convicted in the Circuit Court of the City of Petersburg, Virginia, for a robbery committed May 17, 1983. The court imposed a five-year sentence. One month later, on November 28, 1983, the same court convicted Bernard of robbery and use of a firearm in the commission of a felony on May 13, 1983. The court sentenced Bernard to seventeen years’ imprisonment, to run consecutively with the five-year sentence Bernard had received the previous month.

In 1984 Bernard began habeas proceedings in state court, asserting various constitutional deficiencies in his trial. His initial federal habeas petition, filed in November 1984, was dismissed in March 1985 for failure to exhaust all state remedies. A second federal petition, filed after further state proceedings, was dismissed on the same grounds in 1987.

More state proceedings followed, after which Bernard filed the instant petition on May 11, 1989 in the United States District Court for the Eastern District of Virginia at Richmond. In this petition, which Bernard filed after his seventeen-year sentence had begun, he challenged the validity of the conviction which led to his five-year sentence. The Commonwealth moved to dismiss on the ground that Bernard was no longer “in custody” with regard to the five-year sentence as required by 28 U.S.C. § 2254. The Commonwealth cited as authority Maleng v. Cook, 490 U.S. 488, 109 S.Ct. 1923, 104 L.Ed.2d 540 (1989), which held that a habeas corpus petitioner is not “in custody” as to a challenged conviction when the sentence imposed for that conviction has fully expired at the time of filing the petition.

On September 22, 1989, the magistrate judge dismissed Bernard’s petition on grounds of lack of jurisdiction under 28 U.S.C. § 2254(a), holding that Bernard was no longer in custody because he was “fully discharged from the conviction he is challenging in this petition.” Bernard filed a Rule 59(e) motion for reconsideration several weeks later, contending that Maleng was inapplicable because he was serving one total term of twenty-two years. The magistrate judge denied the motion. Bernard then appealed to this Court.

II.

Federal courts may only take jurisdiction over a petition for a writ of habeas corpus when the prisoner is “in custody in violation of the Constitution or laws or treaties of the United States.” 28 U.S.C.A. §§ 2241(c)(3), 2254(a) (1977). Congress in these statutes did not define the term “in custody,” so the courts have assumed that responsibility. Peyton v. Rowe, 391 U.S. 54, 59, 88 S.Ct. 1549, 1552, 20 L.Ed.2d 426 (1968) (“custody” must be understood by recourse to the common law and to the decisions of the Supreme Court interpreting and applying the common law principles).

Bernard asserts that he is “in custody” with regard to his challenge to his first conviction, since he continues to serve consecutive sentences which include the initial offense. Bernard relies on the Supreme Court’s holding in Peyton, in which the petitioner Rowe was serving consecutive sentences for Virginia crimes. There the Court held that a prisoner serving consecutive sentences is in custody under any one of them for purposes of Section 2241(c)(3). 391 U.S. at 67, 88 S.Ct. at 1556. “Custody,” the Court stated, comprehends such a petitioner’s status for the entire duration of his imprisonment — the aggregate of the sentences. 391 U.S. at 64, 88 S.Ct. at 1554-55.

The Commonwealth maintains that Bernard’s situation is governed not by Peyton but by the Supreme Court’s recent decision in Maleng v. Cook, 490 U.S. 488, 109 S.Ct. 1923, 104 L.Ed.2d 540 (1989). In Maleng, the Court held that an inmate is not in custody on an initial offense when he has fully served his sentence on that offense and attempts to challenge the initial conviction while serving time on a second offense for which he received an enhanced sentence because of his first conviction. 490 U.S. at 492, 109 S.Ct. at 1926. The Commonwealth claims that Bernard’s five-year sentence had fully expired at the time he filed the instant habeas petition, and that therefore Maleng bars the district court from taking jurisdiction to entertain his petition.

We find that Peyton and not Maleng controls this case. Peyton sets forth quite clearly the law concerning the custody status of prisoners who are serving consecutive sentences: for such prisoners, custody for habeas purposes is defined not by any one particular sentence but by the aggregate of the sentences. 391 U.S. at 64, 88 S.Ct. at 1554-55. Maleng does not affect Peyton because in Maleng the Court did not address consecutive sentences, nor did it attempt to define when the first sentence is discharged.

In Maleng, the petitioner Cook was paroled from his initial 1958 sentence on a state crime when he committed the crimes which resulted in his second sentencing in both federal and state court. Under this sentencing, Cook was to serve the federal term first; when that term expired he was to begin serving the 1978 state sentence, which was enhanced because of his 1958 conviction. In 1975, while still a federal prisoner, Cook filed a habeas petition challenging the validity of his 1958 conviction and alleging that the 1958 conviction had been used illegally to enhance his 1978 state sentence. The Supreme Court found that federal jurisdiction over Cook’s petition was lacking, holding that the collateral consequences of an initial conviction for which the sentence has completely expired do not constitute “custody” for habeas purposes. 490 U.S. at 492, 109 S.Ct. at 1926.

Bernard’s situation is quite distinct from Cook’s and similar in all relevant respects to Rowe’s. Bernard’s sentences, like Rowe’s, were imposed to be served consecutively. Unlike Cook, Bernard remained in physical custody of the Commonwealth at the time of filing his petition — custody that has never been interrupted since he began serving the consecutive sentences. In Mal-eng the Supreme Court reiterated its earlier assessment of the importance of physical custody under the challenged conviction in determining whether custody for habeas purposes exists. 490 U.S. at 492,109 S.Ct. at 1926 (citing Carafas v. Lavallee, 391 U.S. 234, 238, 88 S.Ct. 1556, 1559-60, 20 L.Ed.2d 554 (1968)); accord Leonard v. Hammond, 804 F.2d 838, 842 (4th Cir.1986) (holding that once federal habeas jurisdiction has attached by virtue of petitioner’s having been in physical custody when the habeas petition was filed, it is not defeated by the release of petitioner prior to completion of proceedings on the petition). While the Court did not pause to define a “fully expired” sentence, it is clear that in Mal-eng the state’s custody of Cook on his first sentence terminated prior to the filing of his habeas challenge to that conviction. The Court’s finding that Cook was no longer “in custody” for purposes of challenging his first conviction because he suffered no restraint on liberty from that sentence at the time of his challenge is consistent with Peyton’s determination that a sentence is not “fully expired” until the restraint from that sentence has terminated.

Bernard and Rowe differ as to the portion of their aggregate sentence for which they were in physical custody when they filed their petitions. Rowe’s petition challenged a consecutive sentence he had yet to begin serving, while Bernard’s challenge is to a consecutive sentence he has already served. This difference is irrelevant in applying Peyton to Bernard’s case, in the light of the Court’s holding that a prisoner serving consecutive sentences is “in custody” under any one of them. 391 U.S. at 67, 88 S.Ct. at 1556.

Moreover, Virginia law treats Bernard’s sentences, as it did Rowe’s, as one aggregate sentence. The Court in Peyton regarded as dispositive the fact that the Virginia parole statute provided that Rowe’s parole eligibility was to be determined on the basis of an aggregate sentence of fifty years, the total of his thirty-year and twenty-year sentences. The Court stated, “For purposes of parole eligibility, under Virginia law [Rowe] is incarcerated for 50 years.” 391 U.S. at 64, 88 S.Ct. at 1555 (citing Va.Code Ann. § 53-251 (1967)). Virginia’s parole eligibility law remains unchanged today. Va.Code Ann. § 53.1-151(A) (1988 & Supp.1990). Bernard is incarcerated under this law for one period of twenty-two years, not two periods of five and seventeen years each. Having designed its law in this manner, Virginia must accept the consequences of that law’s consistent application.

The magistrate judge’s dismissal of Bernard’s petition is

REVERSED. 
      
      . With the petitioner's consent, the district court referred the petition to the jurisdiction of the magistrate- judge pursuant to 28 U.S.C. § 636(c)(1).
     
      
      . Cook's first sentence expired by its terms in 1978.
     
      
      . The Supreme Court has held that, consistent with the traditional function of the writ of habe-as corpus to secure release from illegal custody, other forms of significant restraint by the state on the petitioner's liberty may substitute for actual physical custody in determining whether the petitioner is "in custody." See Jones v. Cunningham, 371 U.S. 236, 83 S.Ct. 373, 9 L.Ed.2d 285 (1963) (parole constitutes "custody" within meaning of habeas corpus statute).
     