§ 717. Public defender; duties. 1. The public defender shall represent, without charge, at the request of the defendant, or by order of the court with the consent of the defendant, each indigent defendant who is charged with a crime as defined in section seven hundred twenty-two-a of the county law in the county or counties in which such public defender serves. When representing an indigent defendant, the public defender shall counsel and represent him at every stage of the proceedings following arrest, shall initiate such proceedings as in his judgment are necessary to protect the rights of the accused, and may, in his discretion, prosecute any appeal, if in his judgment the facts and circumstances warrant such appeal.
2. The public defender shall also represent, without charge, in a proceeding in family court or surrogate's court in the county or counties where such public defender serves, any person entitled to counsel pursuant to section two hundred sixty-two and section eleven hundred twenty of the family court act and section four hundred seven of the surrogate's court procedure act, or any person entitled to counsel pursuant to article six-C of the correction law, who is financially unable to obtain counsel. When representing such person, the public defender shall counsel and represent him at every stage of the proceedings, shall initiate such proceedings as in the judgment of the public defender are necessary to protect the rights of such person, and may prosecute any appeal when, in his judgment the facts and circumstances warrant such appeal.