
    Anthony D. RETIC, Petitioner-Appellant, v. UNITED STATES of America, Respondent-Appellee.
    No. 06-11799
    Non-Argument Calendar.
    United States Court of Appeals, Eleventh Circuit.
    Feb. 2, 2007.
    
      Brett M. Bloomston, Bloomston & Calla-way, Birmingham, AL, for Petitioner-Appellant.
    Jenny Lynn Smith, Joyce White Vance, U.S. Attorney’s Office, Birmingham, AL, for Respondent-Appellee.
    Before TJOPLAT, ANDERSON and BIRCH, Circuit Judges.
   PER CURIAM:

Anthony D. Retie appeals the district court’s denial of his “motion to compel,” which the district court construed as a motion under 28 U.S.C. § 2255 or a petition under 28 U.S.C. § 2241. We granted a certificate of appealability (“COA”) on the following questions:

(1) whether the district court correctly construed the motion as a 28 U.S.C. § 2255 motion to vacate or a 28 U.S.C. § 2241 petition and dismissed it because Retie was not in federal custody, and
(2) if not, whether Retie was entitled to relief under 28 U.S.C. § 2241(c)(l-4), or any other provision of law.

We review de novo questions of law presented in a COA. Medberry v. Crosby, 351 F.3d 1049, 1053 (11th Cir.2003). “The availability of habeas relief under § 2241 presents a question of law that [we] review[ ] de novo. Sawyer v. Holder, 326 F.3d 1363, 1365 n. 4 (11th Cir.2003) (citation omitted). Further, we liberally construe allegations contained in pro se habeas petitions. Holsomback v. White, 133 F.3d 1382, 1386 (11th Cir.1998).

I.

Retie, while proceeding pro se, filed a “motion to compel” in the district court. He alleged that he was a party to a plea agreement with both federal and state prosecutors; that the federal prosecutors violated the plea agreement by failing to prosecute him; that the state prosecutors violated the plea agreement by exacting a stiffer sentence than Retie had bargained for; and, finally, that he had not breached the plea agreement.

Retie filed the motion against the United States, seeking specific performance of the plea agreement. Specifically, he requested “that this Honorable Court grant this Motion to Compel and compel the Government and State to honor the original plea agreement with Specific Performance.” At the time he filed the motion, Retie was in state custody, having pled guilty to a number of state offenses. He was never convicted of a federal offense, and is not in federal custody.

The district court treated the motion to compel as a habeas petition under 28 U.S.C. § 2241 or a motion under 28 U.S.C. § 2255. It then dismissed the motion because the petitioner was not serving a federal sentence. The court declined to treat the motion to compel as a habeas petition under sections 2241 and 2254 because Retie had not named his state custodian as a respondent.

“Federal courts sometimes will ignore the legal label that a pro se litigant attaches to a motion and recharacterize the motion in order to place it within a different legal category.” Castro v. United States, 540 U.S. 375, 381, 124 S.Ct. 786, 791, 157 L.Ed.2d 778 (2003). “They may do so in order to avoid an unnecessary dismissal, to avoid inappropriately stringent application of formal labeling requirements, or to create a better correspondence between the substance of a pro se motion’s claim and its underlying legal basis.” Id.

The district court correctly recognized that Retic’s motion amounts to a habeas claim, because it alleges that state and federal prosecutors unconstitutionally breached the plea agreement, resulting in a longer sentence in state court. The district court, however, recharacterized the motion as the wrong kind of habeas action. The court treated it as a motion under § 2255. But section 2255 only applies to a “prisoner in custody under sentence of a court established by Act of Congress.” Retie was not convicted of a federal offense, and is not serving a federal sentence. Thus, by treating Retic’s motion under § 2255, the district court effectively doomed the motion to failure.

Retic’s motion was most appropriately characterized as a habeas petition under sections 2241 and 2254. That remedy extends to “a person in custody pursuant to the judgment of a State court ... on the ground that he is in custody in violation of the Constitution or laws or treaties of the United States.” 28 U.S.C. § 2254. See Medberry v. Crosby, 351 F.3d 1049, 1059 (11th Cir.2003) (state prisoners in custody pursuant to state court criminal conviction have a single habeas corpus remedy, governed by § 2241 and § 2254). Retie is in state custody, pursuant to a state sentence. His motion cited five cases in support of his argument that the sentence was unconstitutionally imposed. See, e.g., Santobello v. New York, 404 U.S. 257, 262, 92 S.Ct. 495, 499, 30 L.Ed.2d 427 (1971) (noting that breach of plea agreement by prosecutor can violate due process). The motion clearly demonstrated an intent to challenge his state convictions as unconstitutional. Retic’s motion therefore amounts to a petition for habeas corpus, and should be treated under § 2254 because he is a state prisoner serving a state sentence.

The district court declined to recharacterize the motion under § 2254 because Retie did not name the state custodian as respondent. While it is true that Retie named the United States as respondent, the district court had an obligation to determine whether the substance of the pro se pleading was cognizable under a different statutory framework. United States v. Stossel, 348 F.3d 1320, 1322 n. 2 (11th Cir.2003). The substance of Retic’s prayer for relief asked the United States to compel the state to honor its part of the agreement: in essence, a request for relief from an allegedly unconstitutional state conviction. The mistaken caption did not relieve the district court of its duty to construe a pro se pleading liberally. Holsomback, 133 F.3d at 1386. The district court therefore should have recharacterized Retic’s motion as a petition under § 2254.

On remand, the district court should treat Retic’s motion as a habeas petition. Currently, the restyled petition is defective because Retie did not name his state custodian as respondent. See 28 U.S.C. § 2242; Rules Governing Section 2254 Cases, Rule 2(a) (“If the petitioner is currently in custody under a state-court judgment, the petition must name as respondent the state officer who has custody”). But rather than dismissing the petition without prejudice and subjecting Retie to a certain statute of limitations bar, the district court should grant him a reasonable time in which to move to amend his petition to add his state custodian as respondent. See West v. Louisiana, 478 F.2d 1026, 1029 (5th Cir.1973) (holding that district court erred by dismissing habeas petition on account of failure to name proper respondent because it “is a procedural rather than a jurisdictional defect, and it may be corrected by amendment of the petition”), affirmed in relevant part by 510 F.2d 363 (5th Cir.1975) (en banc). The district court should also warn Retie of the con sequences of recharacterizing his motion as a § 2254 petitions. See Castro, 540 U.S. at 383, 124 S.Ct. at 792. If Retic fads to amend within the time the district court gives him to name his state custodian as respondent, the district court should dismiss the petition. We further note that this opinion in no way comments on the merits of Retic’s habeas petition.

VACATED AND REMANDED WITH INSTRUCTIONS. 
      
      . Retie filed his motion after the effective date of the Antiterrorism and Effective Death Penalty Act of 1996 (''AEDPA”), Pub.L. No. 104-32, 110 Stat. 1214 (1996). Therefore, the provisions of the Act govern this appeal.
     
      
      . The court in passing also relied on the fact that it "appears” that Retie had not exhausted his state remedies. A district court may not, however, dismiss a habeas petition for failure to exhaust state remedies before the state responds and either sets out an exhaustion defense or waives exhaustion. Davis v. Dugger, 829 F.2d 1513, 1521 (11th Cir.1987).
     
      
      . The district court also treated Retic's motion as a section 2241 habeas petition, but then likewise concluded that such a petition should be dismissed because "there is no conviction or sentence to be challenged.” This conclusion was in error. Section 2241 extends to a prisoner "in custody in violation of the Constitution or laws or treaties of the United States,” regardless of which sovereign imposed the sentence or has the prisoner in custody. 28 U.S.C. § 2241(c)(3). Section 2254 then provides the rules a state prisoner serving a state sentence must follow in bringing the habeas petition. Medberry, 351 F.3d at 1059.
     
      
      . In Bonner v. City of Prichard, 661 F.2d 1206, 1209 (11th Cir.1981) (en banc), the Eleventh Circuit adopted as binding precedent all decisions of the former Fifth Circuit handed down prior to October 1, 1981.
     
      
      . The record presently does not reflect that Retic has filed a prior § 2254 petition. We do not, however, foreclose the possibility that Retic has filed a previous § 2254 petition, with all its attendant consequences. See 28 U.S.C. § 2244(b) (providing the strict requirements for claims presented in second or successive § 2254 petitions).
     
      
      . Retie also argues on appeal, by counsel, that his motion to compel should be recharacterized as a petition for a writ of mandamus against the state and federal prosecutors. Mandamus lies only when “no other adequate remedy is available.” Cash v. Barnhart, 327 F.3d 1252, 1258 (11th Cir.2003). Retie potentially has a habeas remedy against his state custodian, meaning mandamus is not proper at this time. We otherwise express no opinion regarding Retic's eligibility for mandamus relief.
     