If the final determination of such proceeding be favorable to such accused officer, he shall be allowed the reasonable and necessary expenses he has incurred in his defense, including a reasonable attorney fee, to be fixed by the court or judge. Such expenses shall be paid by the county, if he be a county officer; by the township, if he be a township officer; and by the municipality if he be an officer of such municipality.
SDCL 3-17-10