HOUSTON (AP) — A federal appeals court ruled Wednesday that a 5-year-old Guatemalan child in U.S. custody must be allowed to be seen by a pediatric neurologist for a head injury he suffered before his family was arrested.

The 9th U.S. Circuit Court of Appeals ruled against U.S. Immigration and Customs Enforcement, which has defended the care given to the child and sought to deport him and his family.

The child fractured his skull and suffered bleeding around his brain in a December fall, a month before his family was detained and taken to an ICE family detention center in Dilley, Texas. The boy’s father is at a jail in California.

The family’s advocates say the child still has headaches and trouble hearing normal levels of sound, indicating he could be suffering from the aftermath of a traumatic brain injury. They have asked that he be taken to a pediatric neurologist, as had been prescribed by doctors who saw him before the family was detained.

ICE says medical staff at Dilley and at a San Antonio hospital determined he did not need to see a neurologist.

The appeals court on Wednesday gave advocates for the family seven days to take the child to a pediatric neurologist and pediatric neurosurgeon. The family’s lawyers will have 15 days to file a status report, after which the U.S. government can move to seek the family’s deportation.

Dr. Amy Cohen, executive director of the advocacy group Every Last One, said Wednesday that she was “gratified” by the court’s ruling.

“Children in the custody of the government deserve to have their basic health needs met,” she said.

ICE did not immediately respond to a request for comment.