(A) A petition for writ of habeas corpus challenging the legality of the petitioner's detention or confinement in a criminal matter shall be filed with the clerk of courts of the judicial district in which the order directing the petitioner's detention or confinement was entered.
(A) A petition for writ of habeas corpus challenging the legality of the petitioner's detention or confinement in a criminal matter shall be filed with the clerk of courts of the judicial district in which the order directing the petitioner's detention or confinement was entered.
The rules for filing a federal writ of habeas corpus are codified in 28 U.S.C. §§ 2241-2256. Generally, one cannot file a writ of habeas corpus unless they show the government has detained them. State prisoners cannot file a federal writ unless they exhaust all available state remedies.