§ 7007. Warrant preceding or accompanying writ. A court authorized to issue a writ of habeas corpus, upon satisfactory proof that a person is wrongfully detained and will be removed from the state or suffer irreparable injury before he can be relieved by habeas corpus, shall issue a warrant of attachment directed to an appropriate officer requiring him immediately to bring the person detained before the court. A writ of habeas corpus directed to the person having custody of the person detained shall also be issued. Where it appears that the detention constitutes a criminal offense, the warrant may order the apprehension of the person responsible for the detention, who shall then be brought before the court issuing the warrant and examined as in a criminal case.