A Texas Petition for a Writ of Habeas Corpus Under 28 U.S.C. 2241 (AO 242) is a legal document that is filed in federal court when a person believes they are being held in custody unlawfully. By filing this document, the petitioner is asking the court to review the legality of their detention and order their release if the court finds that the person is being held unlawfully. Generally, there are two types of Texas Petition for a Writ of Habeas Corpus Under 28 U.S.C. 2241 (AO 242): 1) A Petition for Writ of Habeas Corpus ad Testificandum, which is used when the petitioner is seeking their own release, and 2) A Petition for Writ of Habeas Corpus ad Subjiciendum, which is used when the petitioner is seeking the release of someone else. Both types of petitions must be filed in the federal district court in which the petitioner is detained.