In the worst case, it at least protects society from the person, but I'm optimistic that there are more humane policies that can accomplish all of the above. Imprisonment is about ensuring public safety, to the extent that we can make it humane for the prisoners as well, we ought to do so, but failing that the alternative isn't to release dangerous criminals to reoffend--that's inhumane to their communities (and while some are particularly keen to note that prisoners are more likely to be marginalized minorities, those same people frequently fail to note that the communities that we release these unrehabilitated prisoners back into are also largely marginalized minority communities).