True justice would be something like an eye for an eye, which nobody really wants.
I'm wrestling with the idea of justice these days. Justice entails, I think, that the offended party/victim, is restored what was lost. This could include some equivalence in money for things that cannot be returned exactly as it was taken. It could include money for the cost of the inconvenience. (You steal my car, not only do I not have my car, but I'm paying for taxis.) If the offender lacks resources, the state could pay me and work out other means of recovering the losses from the criminal.
The point here isn't the details, but rather we can imagine an equitable system of justice in such matters.
However, where is the justice in a rape case? A murder case? Can a life be restored? How does one measure the cost of the trauma of a rape victim? In the sense of restitution, there can be no justice.
What we can do is punish. This doesn't bring anything back to the one who lost it. But,
free will or not (still on topic!

), we are bound by our evolution to preserve our species through cooperation. This entails protecting the general population from the actions of a few.
But what about justice for the criminal? For the offending party, a certain loss is justice. But our responsibilities to the criminal go beyond that, I think. This, though, is tricky. One might contend that the criminal gets no consideration. However, even the most draconian of penal systems imagine that the punishments they mete out are proportionate. I've read Jewish rabbis assert that "an eye for an eye" sets a maximum punishment, not a mandatory one.
So where do our responsibilities begin and end? (I'm just thinking "out loud", here.) First, I would argue that mere punishment is not just. It is vindictive and serves no purpose but to make the punisher feel better about their losses. Society, and hence the species, gains nothing from this. After a few thousand years, we're beginning to realize that chopping off someone's hand or foot is not, in fact, much of a deterrent--at least not to
the will of the criminal. Perhaps the idea that there is no gain is not sufficient.
So, second, I'd argue that there is loss to society due to this vindictiveness. What I see is that people who relish punishment (for others) are themselves no great contributors to the species. Emphasizing punishment brings out encourages baser feelings, maybe tattle-tales, framing people, vengeance ("I'll see to it that they get theirs.") So, now what?
Third, as I've stated elsewhere punishment is not just if it is not rehabilitative at least where rehabilitation is possible (a Ted Bundy might not be possible.) At minimum, this idea fosters the hope that almost all mistakes are recoverable. This is good for society, so I would argue. If a thief gets educated in the slammer and becomes a surgeon, is not society benefited? Certainly compared to a cycle of recidivism. Others have pointed out that rehabilitation is more cost effective than mere punishment. I would hope that my idealized example points that way. Does this mean then that some might commit crimes to gain these societal benefits? Yeah, it might. So ...
Fourth, concepts of justice aren't just about crime but about what is due to the average member of society. We don't want John Doe stealing a car just so he can get a free education in prison. This then is the direction I think society must go (and some countries have already taken steps in that direction). If one can get an education without crippling debt, if one can get sick without crippling debt, if one can expect to eat, if one can expect not to freeze to death, then one is
free to contribute to society. Not all will, but surely society will be better. And that's the goal isn't it?
Justice, then, entails that we take these steps to better society.