According to Article 35 of the Criminal Procedure Law, the defender's duty is to put forward materials and opinions on the innocence, light crime or mitigation or exemption of criminal responsibility of criminal suspects and defendants according to facts and laws, and to safeguard the litigation rights and other legitimate rights and interests of criminal suspects and defendants.
It can be seen that lawyers also perform their legal duties while defending the defendant. Lawyers can put forward defense opinions from the perspective of benefiting the defendant, so that the court can consider the case more comprehensively and let the defendant get a more just judgment.
Therefore, even if the defendant is guilty, the lawyer should still defend the defendant.