A New Jersey appeals court has ruled in a precedential decision that state courts cannot order criminally charged immigrants facing deportation to be detained in state custody to ensure that they are not removed from the country by federal immigration authorities before trial.

The Appellate Division's ruling, which examines the state bail reform law's interaction with federal immigration law, comes in the consolidated appeals of defendants Juan Molchor and Jose Rios, who were arrested and charged with second-degree assault after allegedly smashing bottles over an acquaintance's head at a party.

According to Appellate Division Judge Mitchel Ostrer's opinion Wednesday, the prosecution argued that the pair were a flight risk because of their undocumented status. Prosecutors also expressed concern that if they were taken into U.S. Immigration and Customs Enforcement custody, they could be deported without the "benefit of justice from having a fair trial."