The law is a tool of established classes, supposed to be neutral, but rarely is, affected by everything from financial circumstances in crafting defenses to what is policed.
The first thing villains do, moreover, when in power is change the law in their favor.
The law has supported awful things.