A defense lawyer in the American system of justice -- an adversarial system -- is to defend his client zealously.
As a defense attorney in America you must present the best defense possible for your client, even if you know that client is guilty. The client is presumed innocent before and until the State proves the client guilty beyond a reasonable doubt.
However, most states prohibit you from soliciting answers from a Defendant that you know are false answers. For example, if the defendant admitted he did the crime, then you cannot call him to the stand and ask him questions that call for an answer requiring him to state that he did not do the crime.
Furthermore, it is the attorney's responsibility to force the State to prove each and every element of the alleged crime beyond a reasonable doubt. Elements or crimes are the actions required to commit the crime -- for example, the elements of larceny would be: 1) the taking of, 2) the property of another, 3) without the other's consent, and 4) with the intent to permanently deprive the other of his/her ownership rights.
Finally, it is the defense attorney's responsibility to present any and all defenses applicable to the client. Some well known defenses include insanity, self-defense, and alibi.
Of course the defense attorney must explain all the legal aspects of the case to the defendant, including the right of the defendant to appeal.