Perhaps you put “legal” in quotes. After all, so was slavery once upon a time in the U.S. and apartheid in South Africa. Laws represent what a government and sometimes perhaps even a majority of the people want at a given point in time. They change and are changeable; what once was a potential felony in Colorado is now a tourist draw.
Laws, manipulated for terrible ends, must be challenged when they come into conflict with the fundamental principles and morals of a free society. Laws created Nelson Mandela, the terrorist (whom the U.S. kept on its terror watch list until 2008), and laws created Nelson Mandela, the president.