One point: it is not "wrong" for a lawyer to defend his client to the best of his ability, and do his best to get an acquittal, EVEN IF THE CLIENT IS GUILTY.
Not for all values of "guilty". It is not ethical, and in fact against both the rules and the law for a lawyer to lie on his clients behalf. So if the lawyer knows that his client is "guilty" (a client can't by definition be guilty, since the court hasn't ruled on the matter yet), through e.g. a private confession, but the client then instructs his lawyer to act as if that wasn't true, then the lawyer must recuse himself.
As the information exchanged between the attorney and client is privileged, he can't tell anyone why he recused himself, but recuse he must.
This is why lawyers are sometimes careful in discussing certain things with their clients, in some instances, the less they know, the more effectively they can represent their clients.
Now of course, if a lawyer thinks his client is "probably" guilty, that hasn't and can't have any bearing on the case. The defence attorney is there to defend, not help the prosecution make their case. If the client maintains their innocence so be it.
Now, in actual fact in the US at least, with the current plea bargaining system, this is not the problem. Its the complete opposite. It's the lawyer who will instruct his client to plead guilty, even when the client maintains his innocence, as the system is rigged (and contains abominations like the Alford plea...), and the risk of a trial is too great if you're not independently wealthy.