A court order that protects people from arbitrary imprisonment by requiring officials of the government to bring them before a court and state the reasons for detaining them is called a "writ of habeas corpus".
Writ of habeas corpus (which actually intends to "create the body") is a court request to a man or organization holding somebody in authority, (for example, a superintendent) to convey the detained individual to the court issuing the request and to demonstrate a substantial explanation behind that individual's confinement.
Some of the time, particularly where there are debated certainties, the court may hold an evidentiary hearing before decision on a writ of habeas corpus.