
525 F.3d 205 (2008)
Sala-Thiel THOMPSON, Petitioner-Appellant,
v.
Wayne CHOINSKI, Federal Bureau of Prisons, Respondent-Appellees.
Docket No. 04-5079-pr.
United States Court of Appeals, Second Circuit.
Submitted: February 27, 2007.
Decided: May 8, 2008.
*206 Sala-Thiel Thompson, pro se, Lewisburg, PA (Tina Schneider, Portland, ME, on the brief), for Petitioner-Appellant.
Kevin J. O'Connor, United States Attorney for the District of Connecticut (Alan M. Soloway and Sandra S. Glover, Assistant United States Attorneys, on the brief), for Respondent-Appellees.
Before: JACOBS, Chief Judge, LEVAL and SOTOMAYOR, Circuit Judges.
LEVAL, Circuit Judge:
Petitioner pro se Sala-Thiel Thompson appeals from the judgment of the United States District Court for the District of Connecticut (Dorsey, Judge), which sua sponte dismissed his petition for a writ of habeas corpus without prejudice to refiling. Thompson is a prisoner serving a 371-month sentence imposed in 1992 by the United States District Court for the Southern District of Florida for bank robbery. At the time of the petition, he was serving that federal sentence in a Connecticut state facility pursuant to a federal-state contract for the housing of federal convicts. Thompson's petition, citing 28 U.S.C. § 2241 as authority, asserts a variety of claims, falling generally into three categories. First, Thompson attacks his bank robbery conviction on the ground that the federal court lacked "jurisdiction over [the underlying] offense." Second, Thompson protests conditions of his confinement imposed by the Connecticut facility, involving denial of access to the law library and denial of kosher food. Third, Thompson protests conditions of confinement prescribed by federal prison officials, largely resulting from prison discipline imposed on him administratively in 1991 at the federal detention facility in Miami, Florida, when he was awaiting trial on the federal bank robbery charges.
*207 The district court dismissed Thompson's petition in its entirety. For the reasons explained more fully below, we affirm the dismissal as to some of the claims, but as to others we vacate the judgment and remand the matter to the district court.

BACKGROUND
In September 1990, Thompson was arrested in Florida for the robbery of Coral Gables Bank and First Union Bank and was charged in the United States district court with armed bank robbery. See United States v. Blackman, 66 F.3d 1572, 1574 (11th Cir.1995). While he was awaiting trial in detention at the Metropolitan Correction Center ("MCC") in Miami, Florida, a hostage-taking incident occurred at the facility, and Thompson was charged in a federal indictment with various felonies, including attempted murder, attempted escape, and hostage taking, relating to the incident. Thompson was then tried on the hostage-taking indictment, and the charges were dismissed. Subsequently, the federal Bureau of Prisons, nonetheless, instituted disciplinary proceedings against him for his role in the hostage-taking incident. The disciplinary charges were sustained, and sanctions were imposed on him, including loss of good time credit and assignment of a high security status, which affects the type of prison facility in which he may be held and results in restrictions on the conditions of his confinement.
In 1992, Thompson was tried in the United States District Court for the Southern District of Florida on the charges relating to the bank robbery. He was convicted of two counts of armed bank robbery and two counts of using a firearm in the commission of a felony, and was sentenced to 371 months imprisonment.[1] In 2004, pursuant to an agreement between Connecticut and the federal Bureau of Prisons, he was transferred from federal prison to a Connecticut state facility for the service of his sentence. He alleges further that during his confinement, the Bahamian authorities lodged a detainer, whose pendency adversely affects the conditions of his confinement.
In 1997, Thompson filed his first petition for habeas corpus under 28 U.S.C. § 2255 in the United States District Court for the Southern District of Florida seeking to vacate the conviction. The district court denied the petition on August 7, 1998, Thompson v. United States, No. 97-1100-CIV-Highsmith (S.D.Fla. Aug. 7, 1998), and the denial was upheld on appeal by the Eleventh Circuit. Thompson v. United States, 252 F.3d 438 (11th Cir.2001) (unpublished table decision). Later, on May 17, 2004, Thompson filed a second petition, citing 28 U.S.C. § 2241 in the United States District Court for Connecticut, which, like this one, challenged his conviction on the grounds that the Florida district court lacked jurisdiction to try him. The Connecticut district court transferred that petition to the United States District Court for the Southern District of Florida, Thompson v. Choinski, No. 3:04CV823(CFD), 2004 WL 1900428 (D.Conn. Aug. 16, 2004), where the district court dismissed it by reason of Thompson's failure to obtain permission to file a second or successive petition. Thompson v. United States, No. 04-22275-CIV-Jordan (S.D.Fla. Oct. 15, 2004). The Eleventh Circuit dismissed Thompson's appeal. Thompson v. Choinski, No. 04-15861-A (11th Cir. Jan. 26, 2005).
Shortly after filing the second petition, on May 21, 2004, Thompson filed this petition in the United States District Court for Connecticut. As noted, this petition includes a variety of claims. It attacks *208 Thompson's conviction on the ground that the trial court lacked jurisdiction; it attacks the conditions of his confinement imposed by federal prison officials  in part resulting from the Bahamian detainer, and in part resulting from the prison discipline imposed on the basis of the hostage-taking incident in the Miami MCC; and it protests the Connecticut prison's denial of kosher food and of access to the prison library. Without reaching the merits of Thompson's petition, the district court dismissed it without prejudice on the grounds that: (1) Thompson should have pleaded a civil rights action, as under 42 U.S.C. § 1983, rather than a habeas corpus petition under 28 U.S.C. § 2241; (2) the court was not authorized to adjudicate a petition containing joint claims for relief under a habeas corpus statute and under the civil rights law; and in any event, (3) the court was not authorized to adjudicate the habeas petition of a prisoner in a state institution, which Thompson was at the time, until Thompson had complied with the requirements of 28 U.S.C. § 2254(b)(1)(A) by "exhaust[ing] the remedies available in the courts of the State" of Connecticut. Thompson then brought this appeal. During the pendency of this appeal, Thompson was transferred from the Connecticut facility to the United States Penitentiary at Lewisburg, Pennsylvania.

DISCUSSION

I. Thompson's Challenge to the Jurisdiction of the Florida District Court
In one of Thompson's claims, he asks the court to set aside his conviction on the ground that the trial court lacked jurisdiction. (While Thompson asserts that his claim is brought under 28 U.S.C. § 2241, such a claim in fact comes under 28 U.S.C. § 2255. See 28 U.S.C. § 2255(a) ("A prisoner in custody . . . claiming the right to be released upon the ground that the sentence was imposed in violation of the Constitution or laws of the United States, or that the court was without jurisdiction to impose such sentence . . . may move . . . to vacate, set aside or correct the sentence."); see also Jiminian v. Nash, 245 F.3d 144, 146-47 (2d Cir.2001).) At the time he filed the petition, Thompson had previously petitioned unsuccessfully to set aside the conviction. See Thompson v. United States, 252 F.3d 438 (11th Cir.2001) (unpublished table decision). This petition accordingly was what is described in § 2255 as a "second or successive" petition. A "second or successive" petition may be heard only if it is found to assert either "(1) newly discovered evidence that, if proven and viewed in light of the evidence as a whole, would be sufficient to establish by clear and convincing evidence that no reasonable factfinder would have found the movant guilty of the offense; or (2) a new rule of constitutional law, made retroactive to cases on collateral review by the Supreme Court, that was previously unavailable." 28 U.S.C. § 2255(h). Thompson's claim does not satisfy either requirement.[2] To the extent the petition sought to set aside the conviction, the petition was not authorized by law. We therefore *209 affirm the dismissal of Thompson's jurisdictional claim.

II. Thompson's Claims as to the Conditions of Confinement at the State Facility
Two of Thompson's claims seek a modification of the conditions of his confinement at a Connecticut state facility. In particular, the petition asserts that he was not being provided with kosher food or with access to the prison library. As noted above, Thompson has since been transferred from the Connecticut facility to the United States Penitentiary at Lewisburg, Pennsylvania. These claims are therefore moot. Accordingly, the order of dismissal is affirmed.

III. Thompson's Protests Relating to the Federally Imposed Conditions of Confinement
Thompson's other claims protest the federally imposed conditions of his confinement. The district court gave several reasons for dismissing these claims. As its first reason for dismissal, the district court explained that, because Thompson was requesting "damages or injunctive relief, but not release . . . [his] claim [was] properly raised in a civil rights action, not a habeas corpus petition." As a second reason, the district court believed that one "cannot obtain release and injunctive relief/damages in the same action, [and that Thompson] should file separate habeas and civil rights actions to properly raise his claims." As a third reason, the district court found that Thompson had not exhausted some of his claims in the state courts, as required by 28 U.S.C. § 2254. We find that the district court erred in dismissing these claims.
First, to the extent Thompson was seeking injunctive relief from federally imposed conditions of confinement in the service of his federal sentence, we understand neither why the district court believed that the claim should have been styled a civil rights complaint rather than a petition under § 2241 for a writ of habeas corpus, nor what sort of civil rights claim the court envisioned. This court has long interpreted § 2241 as applying to challenges to the execution of a federal sentence, "including such matters as the administration of parole,. . . prison disciplinary actions, prison transfers, type of detention and prison conditions." Jiminian, 245 F.3d at 146 (citing Chambers v. United States, 106 F.3d 472, 474-75 (2d Cir.1997)); see also Carmona v. United States Bureau of Prisons, 243 F.3d 629, 632 (2d Cir.2001) (challenge by federal inmate to administrative proceedings conducted by federal officials properly brought under § 2241); Roba v. United States, 604 F.2d 215, 219 (2d Cir. 1979) (citing Kahane v. Carlson, 527 F.2d 492, 498-500 (2d Cir.1975) (Friendly, J., concurring)).
However, we need not rest on this ground to conclude that the district court erred in dismissing these claims. A pleading by a pro se litigant must be construed liberally. See Triestman v. Fed. Bureau of Prisons, 470 F.3d 471, 474 (2d Cir.2006). If a pro se litigant pleads facts that would entitle him to relief, that petition should not be dismissed because the litigant did not correctly identify the statute or rule of law that provides the relief he seeks.[3]See Moorish Science Temple of *210 Am., Inc. v. Smith, 693 F.2d 987, 989 (2d Cir.1982) (finding error in district court's sua sponte dismissal of pro se prisoner's habeas petition without considering possible claims under § 1983). Thus, even if the district court is correct that Thompson should have styled some of his claims as a civil rights action, if the facts alleged entitled him to relief the court should have treated the claims as properly pleaded, or at least given the petitioner leave to file an amended pleading identifying the proper source of law without dismissing the action.[4]
Second, the district court erred in the belief that a claim for habeas corpus may not be joined in the same pleading with a civil rights claim. The opinion of the Fourth Circuit in Lee v. Winston, upon which the district court ultimately based its conclusion did not require that a plaintiff "elect[] . . . remedies." It focused rather on "judicial election[s] . . . before entry of final judgment," where the plaintiff sought the same relief based on the same facts under both a habeas corpus statute and § 1983. Lee v. Winston, 717 F.2d 888, 893 & n. 4 (4th Cir.1983), aff'd on other grounds, 470 U.S. 753, 105 S.Ct. 1611, 84 L.Ed.2d 662 (1985). We express no view whether we would agree with the holding of Lee v. Winston if we were presented with that question. We note only that the Fourth Circuit's ruling is not a basis, and we know of none, for the view that a petitioner may not seek relief under both a habeas statute and § 1983 in a single pleading.
Finally, the district court believed that dismissal of the petition was required because Thompson had failed to comply with the requirement of § 2254(b)(1)(A) that he first exhaust the remedies available in the courts of Connecticut on his claims challenging the conditions of his confinement in the Connecticut prison. Section 2254(b)(1) indeed provides that an application for a writ of habeas corpus "shall not be granted unless it appears that (A) the applicant has exhausted the remedies available in the courts of the State." This requirement of § 2254, however, applies only to "a person in custody pursuant to the judgment of a State court." The statute has no application to Thompson, who was in custody pursuant to *211 the judgment of a federal court. He was serving his sentence in a State prison only as a contractual accommodation.[5]

CONCLUSION
The judgment of the district court dismissing the petition insofar as it sought relief from (1) the petitioner's conviction and (2) the actions of his custodians in the Connecticut prison system, which denied him kosher food and access to a law library, is affirmed. Insofar as the petition sought relief from the conditions of his confinement as a federal prisoner, the judgment of dismissal is vacated, and the matter is remanded for further proceedings.
NOTES
[1]  His convictions and sentence were upheld by the United States Court of Appeals for the Eleventh Circuit. United States v. Blackman, 66 F.3d 1572 (11th Cir.1995).
[2]  Nor has Thompson made any argument that his case falls under § 2255's "savings clause," which permits the use of § 2241 if § 2255 is "inadequate or ineffective to test the legality of his detention." 28 U.S.C. § 2255(e). This court has held that a remedy is "inadequate or ineffective in circumstances in which `the petitioner cannot, for whatever reason, utilize § 2255, and in which the failure to allow for collateral review would raise serious constitutional questions.'" Jiminian v. Nash, 245 F.3d 144, 147 (2d Cir.2001) (quoting Triestman v. United States, 124 F.3d 361, 377 (2d Cir. 1997)). In Jiminian, we found that no "serious constitutional question" was raised by the gatekeeping requirements for second or successive petitions because the petitioner could have raised his claim in his first petition. Id. The same is true of Thompson's challenge to the district court's jurisdiction.
[3]  The district court dismissed Thompson's claims sua sponte without giving him a chance to be heard in opposition. We have repeatedly cautioned against this practice because, among other reasons, providing notice and an opportunity to be heard "avoids the risk that the court may overlook valid answers to its perception of defects in the plaintiff's case." Snider v. Melindez, 199 F.3d 108, 113 (2d Cir.1999). Indeed, "dismissal in such a manner may be, `by itself, grounds for reversal.'" See id. (citing Square D Co. v. Niagara Frontier Tariff Bureau, Inc., 760 F.2d 1347, 1365 (2d Cir.1985) (Friendly, J.)).
[4]  The government concedes that these claims relating to improper imposition of discipline were properly pleaded under § 2241 (and thus consents to the remand), although it argues, relying on Muhammad v. Close, 540 U.S. 749, 124 S.Ct. 1303, 158 L.Ed.2d 32 (2004), that this is not because of the resulting conditions of confinement but rather because improper imposition of prison discipline would "affect the . . . duration of his confinement" by depriving him of good time credit. We find the government's reliance on Muhammad puzzling. That case involved a state prisoner's attack in federal court on the conditions of his confinement pursuant to a state court sentence. The federal statutory scheme for adjudication of claims protesting the lawfulness, duration, or conditions of confinement pursuant to a state court sentence is different in several respects from the scheme for protesting the lawfulness, duration, or conditions of confinement pursuant to a federal court sentence. What the Supreme Court said in Muhammad about the propriety of using 28 U.S.C. § 2254 to challenge conditions of confinement in the service of a state sentence would not necessarily apply to the propriety of a claim under § 2241 to challenge conditions of confinement in the service of a federal sentence. However, we need not resolve the question. If the claim was properly made in federal court, the district court should not have dismissed it, even if the legal source of the claim was misidentified.
[5]  We in no way imply that there are no exhaustion requirements applicable to Thompson. See, e.g., 42 U.S.C. § 1997e(a) ("No action shall be brought with respect to prison conditions ... by a prisoner ... until such administrative remedies as are available are exhausted."); Carmona v. U.S. Bureau of Prisons, 243 F.3d 629, 634 (2d Cir.2001) ("[F]ederal prisoners must exhaust their administrative remedies prior to filing a petition for habeas relief."). We do not discuss these requirements as they may apply to Thompson's claims because the district court did not rule on them, and the record on appeal does not include the facts necessary to determine the issue.
