Slavery was the law
Many believed that slavery was immoral
There was a fugitive slave law: anyone who knew of a runaway slave was obligated to return that slave to the rightful law abiding owner.
Abolitionists, who believed that slavery was immoral, would committed the crime of helping slaves escape.
________________________________________
Apartheid was the law. Mandela believed that apartheid (segregation) and discrimination were immoral and broke, broke the law, and spent 20 years in jail.
________________________________________
Hiding Jews from the Nazis was a crime. Some people hid Jews from the law abiding Nazis.
________________________________________