WICHITA, Kan. (AP) — A federal appeals court has ruled that judges cannot deny bail to immigrants in criminal cases solely because they are living in the country unlawfully and could be deported before trial.

The little-noticed ruling by a three-judge appellate panel last week noted that it's the first decision of its kind in the 10th Circuit Court of Appeals, setting the legal standard for pretrial release of immigrants in criminal cases across a territory that includes Oklahoma, Kansas, New Mexico, Colorado, Wyoming, and Utah.

The 10th Circuit noted that the Bail Reform Act requires judges to decide the pretrial detention of deportable immigrants "on a case-by-case basis," considering various factors to determine the risk a defendant might flee. While doing so, judges cannot consider the possibility of involuntary deportation, the panel said.

At issue in this case was whether a defendant can be considered a flight risk solely because the Bureau of Immigration and Customs Enforcement has lodged a "detainer," which is essentially a formal notice requesting the U.S. Marshals Service to contact ICE before a person is released.

"We don't do blanket analysis of people and that is where we have gotten. The ICE detainer became the scarlet letter of defendants, and it shouldn't have been," said Michael Sharma-Crawford, an immigration lawyer in Kansas City, Missouri, who is not involved in the case. "The defendant's own character is what everybody should be examining."

He called the ruling "profound," since courts can no longer consider immigrants an automatic flight risk just because a detainer is filed.

The appeal court's decision comes in the case of Mario Ailon, a citizen of Guatemala who had lived without legal permission in Dodge City, Kansas, for at least seven years before his arrest in July. ICE referred the matter to the Justice Department for criminal prosecution after determining that he had re-entered the United States illegally after his 2001 removal. He is charged with re-entry after deportation, misuse of a Social Security number, making a false written statement to the U.S. government, and aggravated identity theft.

The appeals court's decision does not necessarily mean immigrants who are released from jail on bond go free, since they would typically be turned over to ICE when a detainer is on file against them. But even then, deportation is not automatic because some receive an immigration bond in the separate civil administrative proceedings while their request for lawful residency is under consideration.

The U.S. attorney's office declined comment. But in court filings, federal prosecutors argued that immigrants who commit crimes would escape punishment if released on bond and deported before trial. Bailed-out defendants with detainers are turned over to ICE, which is statutorily required to deport them within 90 days, even if ICE itself referred them for criminal prosecution, the government contended.

That argument got little traction with the appellate judges, who cited an earlier decision that it is not appropriate for a federal judge to resolve executive branch "turf battles." The panel also said it is not clear to the court that ICE must deport him before trial.

Prosecutors did not allege that Ailon is a danger to the community. They simply argued that he would be deported before trial if released.

The federal public defender's office, which represents Ailon, also declined comment. But in court filings, it argued that the government did not prove he would not show up for trial, given that immigration regulations prioritize criminal prosecutions over removal.

The appellate ruling sends the case back to the lower court, with instructions to set bail conditions for Ailon's pretrial release. It further orders that once bail conditions are met, he should be turned over to ICE custody, pursuant to its detainer.