Detention can be unlawful where it lacks legal authority, violates constitutional or statutory procedure, continues beyond lawful authority, or is otherwise arbitrary.
The court focuses on the legality of the detention rather than deciding every underlying factual dispute in the same manner as a full criminal trial.