You don't make it illegal, you simply ban who the people are voting for, even retroactively if necessary.