A Petition for Writ of Habeas Corpus (Sec. 2241) is a legal document filed by a person (the petitioner) who is being held in state or federal custody, or by someone on behalf of someone who is being held in custody. The petition is filed with the court and seeks to challenge the legality of the incarceration. It asks the court to order the release of the petitioner, or to grant the petitioner a hearing to determine the legality of the incarceration. There are two types of Petition for Writ of Habeas Corpus (Sec. 2241): a “state” writ and a “federal” writ. A state writ is used to challenge the legality of a state-level incarceration, while a federal writ is used to challenge a federal-level incarceration. Both types of writs are governed by the same federal law, 28 U.S.C. § 2241. The petitioner must provide evidence to support their claim that their detention is illegal. The court will then decide whether the petition is legally sufficient and whether it should be granted. If granted, the court may order the release of the petitioner or set a hearing to further determine the legality of the incarceration.