Article One of the United States Constitution
A writ of habeas corpus is a legal action against unlawful detainment that commands a law enforcement agency or other body that has a person in custody to have a court inquire into the legality of the detention. The court may order the person released if the reason for detention is deemed insufficient or unjustifiable. The Constitution further provides that the privilege of the writ of habeas corpus may not be suspended "unless when in cases of rebellion or invasion the public safety may require it". In Ex parte Milligan (1866), the Supreme Court ruled that the suspension of habeas corpus in a time of war was lawful, but military tribunals did not apply to citizens in states that had upheld the authority of the Constitution and where civilian courts were still operating.