What is the Job of a Public Defender?

The job of a public defender is to represent someone in court if they cannot afford a lawyer. It is unlawful for someone to be persecuted without having professional representation.