When it appears to any court authorized by law to issue the writ of habeas corpus that anyone is illegally held in custody, confinement, or restraint, and that there is reason to believe that the person will be carried out of the jurisdiction of the court, or will suffer some irreparable injury before compliance with the writ of habeas corpus can be enforced, the court may cause a warrant to be issued reciting the facts and directed to the sheriff or coroner of the county, commanding the officer to take the person thus held in custody, confinement, or restraint, and forthwith bring that person before the court to be dealt with according to law. The court also may insert in the warrant a command for the arrest of the person charged with the illegal detention and restraint.
N.D.C.C. § 32-22-29