Any public official who knowingly violates any of the provisions of this chapter, and thereby aids in any way the illegal casting or attempting to cast a vote, or who connives to nullify any of the provisions of this chapter in order that fraud may be perpetrated, shall forever be disqualified from holding office in this state and upon conviction shall be sentenced to a state prison for 16 months or two or three years.