Where a person has been arrested in violation of section twenty-five, a justice of the supreme court, a county judge or the court, if any, from which the subpoena was issued or which ordered the witness to attend, or a judge thereof, shall order such person discharged from the arrest upon proof, by affidavit, of the facts.
N.Y. Civ. Rights Law § 27