When it appears to any court, or judge, authorized by law to issue the writ of habeas corpus, that any one 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 judge before whom the application is made, or will suffer some irreparable injury before compliance with the writ of habeas corpus can be enforced, the court or judge may cause a warrant to be issued, reciting the facts, and directed to any peace officer, commanding the peace officer to take the person held in custody, confinement, or restraint, and immediately bring him or her before the court or judge, to be dealt with according to law.
Ca. Pen. Code § 1497