Anyone arrested in the United States or held by someone associated with law enforcement in the United States has a right to a trial before a court. The detainees at Gitmo have been held for more than 10 years. It's time to get them out of there to free up Guantanamo Bay for military operations as opposed to being maintained as a penal facility.
Many people believe that habeas corpus provides citizens with the right to resist unlawful arrest. This is not accurate. Habeas corpus demands that people should be released from imprisonment after the arrest is found to be unlawful. This means that a person who is suspected of terrorism can be lawfully arrested and detained. If the arrest and imprisonment is found to be unlawful, however, the person has the right to be released under a writ of habeas corpus.