The right of habeas corpus guarantees the right to

freedom from unlawful detention or imprisonment.