I wouldn't assume the public defender is clueless and if you or he has an issue with them, you can actually hire someone with your own money that is not paid for by the taxpayers. As they state you get what you pay for. Since you and your friend are paying nothing, I wouldn't expect "Johny Cochrane's" representation. Moreover, if they are undocumented and entered illegally there is usually very little that can be done, particularly if they are convicted of certain felonies. In order to evaluate if your friend has any chance I would recommend speaking with and retaining an immigration attorney.
Immigration and Customs Enforcement (ICE) will regularly place “immigration holds” on inmates that are not United States citizens. If an undocumented inmate or an inmate with expired status has been taken into custody, ICE will place an “immigration hold” that will prevent the inmate from being released on bail until the criminal matter for which the inmate was detained reaches a resolution. Generally, once the criminal matter has been concluded (and sentence served), the inmate will be transferred from state or federal custody to ICE for deportation/removal. It is prudent for anyone involved in this situation to contact an experienced immigration attorney. Good luck.
Regardless of the criminal matter, he is deportable and unless he can establish that he is entitled to relief from deportation, he will be deported. Of course, the criminal matter complicates things, as conviction of most drug charges make a person inadmissible and deportable.
If he has a H&S Code violation, that is not necessarily a deportable offense. He has an ICE hold as he is undocumented & that hold will not be removed. If your friend has been in the US for more than 10 years, has US citizen or resident parent, spouse or child & this is the only crime he has on his record, he will be eligible to apply for cancellation of removal based upon exceptional & extremely unusual hardship to his relatives. If this is only crime, he will also be bond eligible in immigration court. You need to see a lawyer.
Immigration Immigration holds and deportation Immigration detention Immigration court Cancellation of removal in deportation Immigrant status Criminal charges and immigration status Child custody Criminal defense Criminal charges Felony crime Right to counsel in criminal cases Defenses for criminal charges Criminal arrest Arraignment for criminal cases Criminal record