I once read an offbeat story in a hardback SF anthology which I checked out from a library, back around the late 1980s. This story qualified as science fiction, since it was set well in the future when society had changed a great deal, but I don't think it was written by any of the "big names" of the genre. I still remember the plot fairly well, but not the title or any of the character names. Here's an outline:
It was a short story, and the bulk of it was basically a courtroom drama. I don't remember if such terms as "judge" and "district attorney" and "defense counsel" were used in the text, or if the author invented replacements for the traditional terms in order to stress how different his skewed vision of a future society was. (I suspect the latter.) However, characters corresponding to the roles of judge, prosecutor, and defense counsel did much of the talking in the story.
I believe the defense counsel (or whatever he was called) was presented to us as already having a colossal reputation for successfully defending his clients, time after time. A futuristic Perry Mason, you might say.
The prosecution's case involved demonstrating that the defendant had killed a prominent figure by using an archaic weapon which most of the people in the courtroom were evidently unfamiliar with. I think it was a crossbow -- definitely not what we would call "a regular firearm." The prosecution did a good job of showing that the defendant was, in fact, the person who had fired the fatal shot.
The defense strategy was where the plot got particularly weird (as in, this approach wouldn't work in a real-world murder trial). Instead of the local legal system just having a blanket rule against murdering people by any means, I think there was just a long list of specific things which people were forbidden to do (such as firing guns or setting off bombs which might hurt other people). So the defense counsel argued that firing an old-fashioned crossbow at a human target did not squarely fit within the bounds of any of those specific prohibitions; therefore, firing that weapon had not constituted a criminal act. (Apparently this was an accidental loophole in the system; nobody had planned it that way when those laws were being enacted.)
The judge ended up accepting this interpretation of the legal situation. Which seemed to mean the defendant would go free on a technicality, even though everyone knew he had deliberately taken the life of another human being.
However, at the end of the story, there's an ironic twist:
Acting upon instructions from the judge (I'm almost sure), someone picks up the murder weapon and fires it . . . at the defendant, right there in the courtroom . . . since it has just been firmly established that, according to the strict letter of the law, using this weapon against a human target is not a felonious act. Thus the defense attorney preserves his reputation as an advocate who usually or always "wins," but everyone else is satisfied that the defendant got what was coming to him. Nobody seems to miss the guy. (The ethics of this society appeared to have mutated drastically from the ones we take for granted in modern criminal justice systems.)