I'm a lawyer. Let me say, first, that I consider JB is an embarassment to my profession. In my experience, he is also, thank goodness, an aberration.
I understand that the public perceives the goal of the defense lawyer is to get the client off. A lawyer doing his work, on a day to day business, may not disagree. When the client is innocent, the lawyer achieves his or her goal by seeking the truth. When the client is guilty, the lawyer looks for loopholes in statutes, misconduct by police, prosecutors, and jurors, or errors by judges, and seeks to exploit those things for the client's benefit.
But when we stop to philosophize, we see it from a different perspective. We say that there is a social contract among us by which, for our mutual benefit, we consent to live by certain rules. To accomplish this, we create a government to determine what those rules are, and to enforce them. And we empower our government -- and provide it with enormous resources -- to determine who has violated the rules, and to punish them by depriving them of property, liberty, or -- as in this case -- life, itself.
It is the government, not the lawyer, that has the responsibility of deciding who is deserving of punishment. The lawyer's role is to ensure that the government exercises its power to punish correctly.
Whether innocent or guilty, a client's objective is to avoid being punished. So, when the guilty client is convicted and sentenced, the lawyer "loses". But, despite the loss, the lawyer who did his or her job well achieves the important goal of protecting those of us who are innocent by ensuring that the prosecutor's "win" was fair and square.