GENEVA -- The United Nations' human rights chief said Monday she was "appalled" by the conditions migrants and refugees face in U.S. detention facilities, intensifying a challenge to the Trump administration's immigration policies.

United Nations High Commissioner for Human Rights   said children stopped by border agents should never be held in immigration detention facilities or separated from their families, and detention should not be the norm for adults, either.

"Any deprivation of liberty of adult migrants and refugees should be a measure of last resort," the UN commissioner said, appealing for "non-custodial alternatives."

A spokeswoman for the UN human rights office, Ravina Shamdasani, said Bachelet decided to speak out more forcefully than before after the U.S. Department of Homeland Security's inspector general issued a report last week warning of dangerous conditions in U.S. immigration detention facilities.

Many migrants and refugees set off on "perilous journeys with their children in search of protection and dignity and away from violence and hunger," Bachelet said in a statement.

"When they finally believe they have arrived in safety, they may find themselves separated from their loved ones and locked in undignified conditions," she continued. "This should never happen anywhere."

U.S. President Donald Trump said Sunday that migrants were coming from "unbelievable poverty" and "those are people that are very happy with what's going on because, relatively speaking, they're in much better shape right now" in U.S. custody.

He went on to praise the work of the Border Patrol and other law enforcement officers on the U.S.-Mexico border, saying, "it's incredible what they're doing. They've had to become nurses. They've had to become janitors."

The Homeland Security report was the second by the inspector general's office to blast conditions at temporary detention centres in Texas where migrants are held.

The first, based on visits to Border Patrol facilities in western Texas in May, showed dozens of migrants packed into spaces so tight that some had to stand on toilets. It detailed how 900 migrants were in a 125-person facility at one point, with many held for weeks in violation of the government's policy.

Last week's report, released July 2, said several Border Patrol facilities in south Texas were dangerously overcrowded. Detainees banged on cell windows, shouted and pressed notes to a window for inspectors, according to the report released July 2. A photo showed a man holding a piece of cardboard with one word: "help."

Inspectors also warned that many children had no access to showers and were being detained long past the maximum of 72 hours. Five children have died in Border Patrol custody since December.

"As a pediatrician, but also as a mother and a former head of state, I am deeply shocked that children are forced to sleep on the floor in overcrowded facilities, without access to adequate health care or food, and with poor sanitation conditions," Bachelet, a former president of Chile, said Monday.

"Detaining a child even for short periods under good conditions can have a serious impact on their health and development -- consider the damage being done every day by allowing this alarming situation to continue," she said.

Bachelet acknowledged the "sovereign prerogative" of countries to set the conditions under which foreigners are permitted to enter and stay but also highlighted their human rights obligations. Her office said she recognized the "complexity" of challenges faced by migrants' countries of origin, the ones they travel through and destinations like the U.S.

------

Astrid Galvan in Phoenix contributed to this report