A Mexican court has ruled that authorities must stop detaining minors at a migrant center in Mexico City following the death of a 10-year-old Guatemalan girl there.

Monday's ruling also says children in other detention centers must be identified immediately and have access to legal representation. The judges in a Mexico City court also ruled that immigration authorities must urgently put a system in place to allow children to leave detention.

The Guatemalan girl died in May from injuries sustained in falling off a bunk at the detention center known as Las Agujas.

The girl and her mother had been transported to Mexico City by bus from the northern border state of Chihuahua. She died a day after arriving at the facility.