According to the answers in [Are county clerks exempt from Title VII of the Civil Rights Act of 1964][1]
[1]: Are county clerks exempt from Title VII of the Civil Rights Act of 1964? elected officials of pretty much any sort are exempted from the protections under Title VII. But it seems that without this protection, municipalities could enact laws such as "no Muslim or person with a physical or mental disability may hold an elected position."
Something clearly protects this from happening. Yes; it is a violation of the constitution, but from my understanding, laws are what establishes protections against constitutional violations.