A 3-year-old boy died — allegedly during a religious ritual. Children said they were being trained to commit mass shootings. A large weapons cache was found, with practice targets.

On Monday, prosecutors detailed horrifying allegations against five adults who were found with 11 starving children in a makeshift compound in Taos County, New Mexico — but the judge said they weren't backed by enough evidence to keep the defendants behind bars as they await their trial.

"The state alleges that there was a big plan afoot," state District Judge Sarah Backus said in court. "But the state hasn't shown to my satisfaction, in clear and convincing evidence, what that plan was."

Judge Sarah Backus NBC News

The decision stunned many, and prompted threats against Backus. But experts say the move is the result of a series of recent changes to how the state treats defendants before their trials, with "clear and convincing evidence" of being a danger to the community a legal requirement for pre-trial detention with no bail.

"These people have been charged. They have not been convicted," said Leo Romero, a professor emeritus at the University of New Mexico Law School and the chairman of a committee that made recommendations on reforming cash bail in the state, which were adopted by the state Supreme Court in 2017.

"So you're balancing individual rights versus safety of the community, and the judge is weighing that when she is determining the evidence presented by the prosecutor," he said.

New Mexico is part of a wave of a states that, in recent years, have re-examined how they handle bail and pretrial detention.

In 2014, the state Supreme Court, in New Mexico vs. Walter Ernest Brown, deemed that even if someone is charged with a serious offense, a judge has to make an individual determination on whether to detain the defendant before trial.

"Just because someone is charged with first-degree murder or first-degree sexual assault, that by itself is insufficient," Romero said. "The court's got to consider other evidence of whether the person might be a danger or a flight risk, such as the nature and circumstances, which is different than the charge itself."

And in 2016, an overwhelming number of voters agreed to a constitutional amendment that moved the state away from the traditional money-based bail system to an evidence-of-risk-based system of release and detention, in an effort to bring more fairness. The new system took effect last year.

Backus would not comment on the case because it is still pending. Barry Massey, a spokesman for the New Mexico Administrative Office of the Courts, said that "what she said in court yesterday is as much explanation for her decisions as she can provide."

"Prosecutors have to file a motion, and then they have to prove by clear and convincing evidence that no other conditions of release will reasonably protect the public's safety," he said. "What the judge said yesterday is that they didn't meet that burden."

While Backus agreed to release the defendants from jail to house arrest, she required them to wear GPS ankle monitors and to check in weekly with their attorneys, plus cooperate with the New Mexico Children Youth and Families Division.

The decision not to hold the defendants spurred a backlash on social media, with some calling for Backus to resign. The New Mexico Administrative Office of the Courts said the judge had also received threatening phone calls and emails.

State Rep. Bill Rehm, R-Albuquerque, a former law enforcement officer, said he felt Backus had not been tough enough.

"There's the remains of a young child found here," he said. "Someone should be charged with some kind of homicide or murder. Whoever did that clearly is a violent person, and so they should be detained."

Bail was set at $20,000 for each defendant, but Backus said she would allow the defendants to walk out on what's called a signature bond — in which case they don't have to post any cash.

The case has yet another twist: While the five were released to house arrest, because they were living on a makeshift compound on someone else's property, they don't technically have a house to go to.

Massey said that had been solved by offers from residents in Taos County to let them stay with them.

Marie Legrand Miller, a public defender for one of the defendants, Hujrah Wahhaj, confirmed her client had received such offers, but would not say from whom, other than to say the residents didn't have any criminal problems and were in good standing.

"My client would like to obviously get out of jail and she has no desire to go back to the compound property," Legrand Miller said. "The judge has ordered that they not return there, and she has no desire to return there."