The West Virginia Petition for Writ of Habeas Corpus by a Person in Federal Custody — 28 U.S.C' 2241 is a legal action that allows a person in federal custody to challenge their detention in court. It is a form of collateral attack which allows a person to contest the legality of their detention after all direct appeals or post-conviction remedies have been exhausted. The petition must be filed in the court where the person is being held in custody or in the appellate court that has jurisdiction over the matter. There are two types of West Virginia Petition for Writ of Habeas Corpus by a Person in Federal Custody — 28 U.S.C' 2241: the non-capital and the capital habeas corpus petition. The non-capital petition is used to challenge the legality of a person's conviction or sentence, while the capital petition is used to challenge the legality of a death sentence.