The writ of Habeas Corpus is a legal order in which a person under arrest or in prison must be brought before a court. It is used to challenge the legality of a person's detention. If the detention is found to be unlawful, the court will order the person's release. Therefore, it directly guarantees personal freedom by preventing illegal detention.