Absolutely not.

It was illegal to harbour escaped slaves. Or hide Jews from the Gestapo.

Laws have nothing to do with morality. Or justice.

Yes they do, but not with a philosophical concept of morality, but merely those of the ruling class/majority.