It shall be unlawful for any elector to cast his or her ballot during any general election, primary election, municipal election or special election in any precinct, any district, any ward, or any other subdivision where his or her name does not duly appear upon the official list of the precinct, district, ward, or subdivision. All ballots cast in any election contrary to this section are hereby declared illegal and, upon a contest duly instituted, the ballots shall be excluded in determining the final result of any election; provided, that nothing in this section shall prevent any qualified elector residing in the precinct, ward, or voting district from voting after presenting a proper certificate from the board of registrars, or from voting a provisional ballot or a provisional ballot in municipal elections when his or her name does not duly appear upon the official list of the precinct, district, ward, or subdivision.