The UN has acknowledged Washington's decision to stop separating migrant families at the US-Mexico border but insisted that detaining children with their parents was not the solution.
"Children should never be detained for reasons related to their or their parents' migration status," UN rights office spokeswoman Ravina Shamdasani told reporters in Geneva.
"It is never in the best interest of the child for them to be detained," she said.
Her comments came two days after US President Donald Trump, in a stunning about-face, ordered an end to his administration's widely criticised policy of separating families at the border.
Images and recordings of wailing children detained in cage-like enclosures has ignited global outrage, forcing the abrupt change of tactics.
Trump's executive order would keep families together but in custody indefinitely while the parents are prosecuted for entering the country illegally.
The president's order also suggests the government intends to hold families indefinitely by challenging a 1997 court ruling known as the Flores Settlement, which places a 20-day limit on how long children, alone or with their parents, can be detained.
Shamdasani slammed this solution, insisting that Washington "needs to explore non-custodial alternatives to detention, bearing in mind first and foremost the human rights of these migrants, in particular where families and children are involved."
"Irregular migration should not be a criminal offence. These people should not be treated as criminals," she said.
The UN, she said, is calling for the "US to just overhaul its migration policies, urging the country to find "community-based alternatives to detention for children and families."
The UN children's agency UNICEF also vehemently opposes the policy, spokesman Christophe Boulierac told reporters.
"We oppose two things: We oppose separating children from their families for the purposes of migration control but we also oppose to detentions," he said.
He lamented that the United States was among some 100 countries around the world that detain children for the purpose of migration control.
"We are working with governments to change that," he said, insisting that there are "alternatives which are working," including appointing community members who can guarantee that a child will show up in immigration court.