Unusual Topic: Refusal of Criminal Justice Stay Visa

What is the appropriate relationship between the Department of Immigration and the criminal justice system?
Should the Department be able to effectively “override” a decision made by a magistrate to grant a criminal defendant bail by refusing a criminal justice stay visa, with the consequence that a non-citizen will be held in immigration detention pending determination of her or his criminal case?
What if the person is ultimately determined to be innocent of the charge? Won’t he or she have been held in immigration detention improperly?
...