Lawyers represent clients. Criminal defence lawyers represent clients accused of crimes — sometimes horrible, evil clients accused of heinous crimes.
It is the ethical and professional responsibility of these lawyers to defend those clients as vigorously as possible.
Sometimes such representation results in less than perfectly just results.