Here is the fallacy I’m describing:
Someone defends their own actions, or someone else’s actions, as acceptable/justified or necessary, on the basis that those actions might be necessary or justified in certain circumstances, referencing other individuals or circumstances for which it might be necessary or justified, despite their own circumstances/the circumstances in question not having the same elements that would require it or justify it.
For example, someone defends the actions of someone who murdered another person unnecessarily because they disliked them (e.g.), using the argument that there might be people who need to kill in self-defense or in a survival situation for whom it might be justified, despite that not applying to the situation in question.
I’ll attempt to write the form of the fallacy here:
X is justified in Y case.
Someone does X in Z case.
X is justified in Z case because X would be justified in Y case.
It’s a fallacy because:
What is true of Y case doesn’t necessarily apply to Z case; the elements/circumstances of Y case that would make X justified may not be present in Z case, and therefore even if X is justified in Y case it wouldn’t automatically be justified in Z case as a consequence.
The top comment explains it better.