The prosecutor could have made...and probably did make..... a case for flight risk. But if it were a first offense, the judge may have been forced to release, no cause having been found to incarcerate pending trial: the bad guy having been painted by his appointed defender....on our dime....as a wayward yoot who lost his way, and was otherwise a productive non-citizen.
Forced?... or chose... Even if so, don’t blame the defender, blame the judge (among others who may have dropped the ball).
ICE consistently screws up detainers, but the local court needs to do its job as well. Illegal status is a good indicator of flight risk, because they have another place to go to avoid prosecution.