A habeas corpus petition attacking a criminal conviction or sentence shall be filed within two years from the date of final judgment in the trial court. Habeas corpus is perhaps the most critical writ available to prisoners for challenging criminal convictions and sentences in state and federal courts.Federal habeas corpus is a procedure under which a federal court may review the legality of an individual's incarceration. Habeas corpus is available to prisoners challenging their convictions and sentences. The writ of habeas corpus is an extraordinary remedy designed to test the validity and legality of detention or incarceration. A petition for a writ of habeas corpus is a legal challenge to the lawfulness of a person's imprisonment. It allows individuals to challenge their detention in a court of law and provides a check on the executive branch's power. This petition, called a writ of Habeas Corpus, is filed in Federal Court (US District Court ) whether you are serving time in a federal or state prison. Generally, you must receive a ruling on each of your claims from the Supreme Court of. Virginia before this court can address your claim in a § 2254 petition.