The “Trolley problem” in ethics, where you have to decide between pulling a lever to kill one or not pulling a lever and allowing 5 to die, has an obvious answer from a numerical perspective.
But what about from a legal perspective? I would argue that you are legally not permitted to pull the lever and depending on what state you live in, usually not legally compelled to pull the lever.
If the trolley problem were restated as shooting an active murderer on a rampage and saving 5 lives but killing an innocent bystander, the legal question is clear: if you shoot the murderer and kill the bystander you are going to prison unless you are blessed with the legal status of qualified immunity.
Qualified immunity creates a higher category of citizen with more rights than you or I. These people can shoot and miss without legal repercussions and have certain weapons you and I can not in certain places.
I would argue that transfer of intent should work equally as well with the trolley lever puller as the active murderer shooter…but the law hates you and doesn’t want you to be able to fight back for your rights and thus prejudice is used when it comes to firearms.