Thinking about this in the abstract makes it easy to think this way! I'm not an attorney. I am a retired police officer who does contract work for defense attorneys.
Everyone is entitled to defense counsel. It is a cornerstone of our judicial system. Perhaps they are guilty. Then your job is to get them the best terms as far as sentencing is concerned. Perhaps probation. Or, maybe the state's evidence is weak. Then it is your job to create reasonable doubt in the minds of the jurors.
Suppose a 19 yr old holds up a store. No one gets hurt. He is married and has a baby. Should he be locked away for 20 years? This is more likely to result in his wife and baby being on welfare, baby growing up without a Dad, etc. He also has siblings, parents, etc. It's a very human issue.
A person is innocent until proven guilty. If the state cannot prove its case, your client should go free. Sadly, prosecutors believe they should try to get convictions, and sometimes aren't too forthcoming with exculpatory evidence. I worked on a case where the police said our client dropped narcotics from the wristband of his jacket. Except, he was wearing a short-sleeved shirt. Someone needs to point these things out.
Now, when it comes down to truly heinous crimes, I ask myself the same question. I could not work on a case of a mass shooting suspect, for example.
When I first started working for defense attorneys, after having been a police officer, I thought I would have trouble with this. But when you start seeing all the "mistakes" made by police and prosecutors, as well as the excessive use of force situations (I do some Civil Rights cases as well), it all starts to come together. If a guilty person goes free and commits subsequent offenses, it is NOT the fault of the defense attorney - it means the prosecution failed to prove its case.
Hope this helps.
This is a deeply interesting question and, as you can imagine, there is no straight answer. I do not practice criminal law now but have worked briefly in the area as an intern and as a translator/interpreter. When I was doing this work I really felt that what we did was similar to what doctors do. Sometimes a doctor has a patient who has done many things that are just wrong and now those actions have hurt this person's health and possibly that of other people as well. The fact that someone made poor choices, though, does not mean that they do not deserve medical treatment. Nor does it mean that they do not deserve a chance to improve. As medical professionals or as attorneys, we simply work to help people, not to judge them. Judges in court have a different job which is to decide if someone is guilty and whether they deserve a certain type of punishment. To be a criminal law professional, you simply have to believe that people can become better even if they have done something very bad. Helping them does not mean that you agree with what they did or that you would do something similar. It simply means you are willing to help them obtain a second chance. Or even a third and forth chance!
In Matthew 18:21-22, Peter asked Jesus “Lord, how often shall my brother sin against me and I forgive him? Up to seven times?” Jesus *said to him, “I do not say to you, up to seven times, but up to seventy times seven." That means forgiving someone for making a mistake 539 times! Of course, we are not supposed to take this literally and count the times when we forgive people. It means that we need to believe someone (and that includes us, too) can learn from their mistakes.