
    Randy Lee HAMMITT, Petitioner—Appellant, v. UNITED STATES PROBATION OFFICE; D. Mark Hall; James Kent, Respondents—Appellees.
    No. 07-1191.
    United States Court of Appeals, Fourth Circuit.
    Submitted: July 31, 2007.
    Decided: Aug. 9, 2007.
    Randy Lee Hammitt, Appellant Pro Se.
    Before MOTZ and TRAXLER, Circuit Judges, and WILKINS, Senior Circuit Judge.
    Affirmed by unpublished PER CURIAM opinion.
    Unpublished opinions are not binding precedent in this circuit.
   PER CURIAM:

Randy Lee Hammitt appeals from the district court’s dismissal of his petition under 28 U.S.C. § 2241 (2000), in which Hammitt challenged his conviction for criminal contempt. The district court concluded that it lacked jurisdiction over the petition because Hammitt was neither incarcerated when his § 2241 petition was considered nor incarcerated at the time that he filed the petition. The district court held in the alternative that even if Hammitt were considered to be in custody, he had failed to raise any meritorious claims in his petition. Upon review of the record, we find that while the district court possessed jurisdiction over Hammitt’s petition, Hammitt’s claims are not cognizable under § 2241.

A federal prisoner seeking to challenge the legality of his conviction or sentence must proceed pursuant to 28 U.S.C. § 2255 (2000) in the district of conviction, while § 2241 petitions are generally reserved for challenges to the execution of a prisoner’s sentence. In re Vial, 115 F.3d 1192, 1194 n. 5 (4th Cir.1997). However, in limited circumstances, § 2255 is “inadequate or ineffective” to test the legality of the detention. In those cases, a prisoner may file a § 2241 petition in the district of his confinement to challenge his conviction. In re Jones, 226 F.3d 328, 333 (4th Cir.2000). In Jones, this court concluded that § 2255 is inadequate or ineffective, and § 2241 may be used:

to test the legality of a conviction when: (1) at the time of conviction, settled law of this circuit or the Supreme Court established the legality of the conviction; (2) subsequent to the prisoner’s direct appeal and first § 2255 motion, the substantive law changed such that the conduct of which the prisoner was convicted is deemed not to be criminal; and (3) the prisoner cannot satisfy the gatekeeping provisions of § 2255 because the new rule is not one of constitutional law.

Jones, 226 F.3d at 333-34.

Hammitt’s § 2241 petition challenged the legality of his conviction, not the execution of his sentence; therefore, Ham-mitt’s claims should have been presented in a motion under § 2255. See Vial, 115 F.3d at 1194 n. 5. Additionally, Hammitt’s petition failed to demonstrate that § 2255 would be inadequate or ineffective to test the legality of his detention. See Jones, 226 F.3d at 333. Therefore, Hammitt has failed to establish any proper grounds for relief pursuant to § 2241.

Accordingly, we affirm the district court’s order. We dispense with oral argument because the facts and legal contentions are adequately presented in the materials before the court and argument would not aid the decisional process.

AFFIRMED. 
      
      . Hammitt’s § 2241 petition was originally filed with this court; however, we declined to exercise our authority to entertain the petition and transferred it back to the district court for consideration pursuant to Fed. R.App. P. 22(a). In re Hammitt, No. 06-7877 (4th Cir. Jan. 22, 2007) (unpublished).
     
      
      . A petitioner is not required to be subject to imprisonment to be regarded as in custody; rather, the relevant query is whether the petitioner’s status subjects him to a restraint on his liberty, or the imminent threat of such a restraint. See Jones v. Cunningham, 371 U.S. 236, 242, 83 S.Ct. 373, 9 L.Ed.2d 285 (1963). For the purposes of relief under the federal habeas corpus statutes, probation constitutes custody, as a probationer is subject to restraints not shared by the public generally. See Olson v. Hart, 965 F.2d 940, 943-44 (10th Cir.1992); Tinder v. Paula, 725 F.2d 801, 803 (1st Cir.1984); Hahn v. Burke, 430 F.2d 100, 102 (7th Cir.1970). In October 2006, Ham-mitt was sentenced to probation for a term of one year, with six months' home detention. Hammitt’s status as a probationer at the time he filed his petition was sufficient to meet the "in custody” requirement for proceeding under § 2241(c).
     