A young boy whose remains were discovered buried at a New Mexico desert compound died during a ritual ceremony to "cast out demonic spirits," other children found at the remote homestead told investigators, a prosecutor said in court on Monday.

The revelation came during a court hearing for five adults arrested on charges of abusing 11 children at the compound. Authorities raided the compound north of Taos 10 days ago.

"It was a religious ritual carried out on Abdul Ghani, a ritual intended to cast out demonic spirits from Abdul Ghani Wahhaj," Taos County Prosecutor John Lovelace said in describing what the children said about the death of 3-year-old Abdul Ghani Wahhaj.

The children were also trained to use weapons and to defend the compound in the event of an FBI raid, the prosecutor said.