The legislation provides two hurdles for someone to be re-detained - a decision made by a court on an application by the immigration minister.