If the warrant issued, or if the offense is alleged to have been committed, in a county other than the county of arrest, all papers in the proceeding shall be promptly transmitted to a justice of the county having jurisdiction of the offense for preliminary examination or trial. If the defendant is unable to provide bail in the county of arrest, he shall be committed to the custody of an officer who shall take him without unnecessary delay before a justice of the county wherein the examination or trial is to be held, there to be dealt with as provided by law.