Our system of justice depends on the evidence being weighed by a jury, and a verdict being concluded.
In order for this system to work, the evidence must be presented from both sides of the argument, to the best of each Counsel's adbility.
Obviously some Defence Counsel will know that their client is guilty, but the legal system depends on the two-sided argument being presented, and in theory, the correct verdict being reached.
Even though the result is not always the right one, it is believed to be the best and most effective way of providing a fair trial in a democracy.
It is far from perfect, but it is the best there is.