Lawyer defending criminals in court

Q: I am a lawyer by profession. I represent people who are being prosecuted for criminal charges and defend them in court.

In many instances, the accused party confesses to me that they are guilty of the crime for which they are being charged, even though they plead 'not guilty' to the court. In such situations, is it permissible for me to defend the accused in court, knowing that I am defending a guilty person who is lying to the court?

Hadith regarding aiding and supporting unjust rulers

Q: What is the meaning of this?

ليأتين عليكم أمراء يقربون شرار الناس ويؤخرون الصلاة عن مواقيتها فمن أدرك ذلك منكم فلا يكونن عريفا ولا شرطيا ولا جابيا ولا خازنا

Imam Ibn Hibban (rahimahullah) has recorded this Hadith and has declared it authentic.

(Sahih Ibn Hibban; Al Ihsan, Hadith: 4586. Also see: Musnad Abi Ya’la, Hadith: 1115 and Majma’uz Zawaid, vol. 5 pg. 240)