Basically, any law is optional. If you break the law and get caught, there are penalties to pay, but that is after the fact. The law has already been broken and the crime committed.
Once committed, there isn't any law that has prevented murder, gun violence, or any other crime. If that were true then these things would never happen.