Slavery was legal; apartheid was legal; the Nazi’s Nuremberg Laws were legal; the Stalinist and Maoist purges were legal.
The fact of legality does not justify these crimes.
Legality alone cannot be the guide for moral people.
Look at things in terms of right and wrong, not legal and illegal. Live by your principles, not the rules of others.