The defendant, immediately upon being arrested, must be taken to the office of the justice who made the order. If the justice is absent or unable to try the action or if it appears to the justice by the affidavit of defendant that the justice is a material witness in the action, the officer shall immediately take the defendant before another justice of the county, if there is another, and if not, then before a justice of an adjoining county, who shall take jurisdiction of the action and proceed as if the summons had been issued and the order of arrest made by that justice.
§ 27-16-1003, MCA