It shall not be lawful, at the suit of any nonresident, to arrest and hold to bail on mesne process any person who is a nonresident of this State at the time of issuing such process against such person, for any debt contracted without the limits of this State. If any such nonresident is so arrested, he or she may apply by petition in writing to any judge of this State, setting forth his or her residence and the state in which the debt was contracted, and the judge, on the production of satisfactory proof that the plaintiff was a nonresident at the time of issuing the process, and also that the petitioner is a nonresident of this State, and that the debt on which the petitioner was arrested was not contracted in this State, shall discharge the petitioner from custody. This section shall not be construed as affecting in any degree the law of attachment.