Updated

A juvenile court judge ruled Tuesday that a 10-year-old boy charged in the alleged gang-rape of an 8-year-old Liberian girl be released from juvenile detention and placed in a therapeutic foster-care home.

Judge Aimee Anderson also ruled that the boy is incompetent to stand trial after two mental health experts found that he doesn't understand court proceedings or his legal rights.

Anderson ordered that the boy be enrolled in a program that will teach him about the juvenile justice system and render him competent to stand trial within six months. The boy also must wear an ankle bracelet to electronically monitor him while he is out of custody.

The judge's orders brought an emotional response from the boy's family. His uncle told the judge he didn't want the boy in foster care, and other family members wept in court. One aunt yelled at the judge and pointed at her, prompting bailiffs to escort her out of the courtroom.

The boy also cried and told Anderson he wanted to go home; the judge tried to console him.

"Listen, you're going to be out of detention," she said. "You're going to be sleeping in a really nice bed."

A mental-competency hearing for a second 10-year-old boy is also set for Tuesday.

Phoenix police allege the boys, along with a 13- and 14-year-old, lured the girl to an empty storage shed July 16 with the promise of chewing gum, then restrained and raped her. All the children are refugees from the West African nation of Liberia.

The case sparked an international outcry after police reported the girl's father said she brought shame on the family and he didn't want her back — comments a family pastor later said were misunderstood because of a language barrier.

State child welfare officials have custody of the girl.