As Democrats claimed the migrants were being denied basic human rights, the president launched a series of tweets defending his actions, and saying many of those in detention were living in better conditions than they were in the countries they had come from.

“Many of these illegals aliens are living far better now than where they came from, and in far safer conditions,” he wrote. “No matter how good things actually look, even if perfect, the Democrat visitors will act shocked and aghast at how terrible things are.”

He added: “If illegal immigrants are unhappy with the conditions in the quickly built or refitted detentions centres, just tell them not to come. All problems solved.”

The comments were made as the nation got ready to mark the July 4 national holiday and the president prepared to address crowds in Washington DC.

‘Families belong together’ protests over Trump immigration policy Show all 8 1 /8 ‘Families belong together’ protests over Trump immigration policy ‘Families belong together’ protests over Trump immigration policy Mishawaka, Indiana AP ‘Families belong together’ protests over Trump immigration policy Washington DC AFP/Getty Images ‘Families belong together’ protests over Trump immigration policy New York Mayor Bill De Blasio speaks in Tornillo, Texas alongside the many other US mayors who have called for detained immigrant children to be reunited with their families AP ‘Families belong together’ protests over Trump immigration policy Albuquerque Mayor Tim Kelle leaves a teddy bear as a gift for detained immigrant children in Tornillo, Texas AP ‘Families belong together’ protests over Trump immigration policy Seattle Mayor Jenny Durkan and Los Angeles Mayor Eric Garcetti leave sandals as gifts for detained immigrant children in Tornillo, Texas AP ‘Families belong together’ protests over Trump immigration policy San Diego, California EPA ‘Families belong together’ protests over Trump immigration policy US embassy, Mexico City AFP/Getty Images ‘Families belong together’ protests over Trump immigration policy San Diego, California EPA

Democrats condemned the conditions revealed by the department of homeland security’s office of inspector general, and said the president should act immediately.

“How can anybody look at these photos and think this isn’t a human rights abuse,” tweeted California senator Kamala Harris, one of nearly two-dozen Democrats seeking the party’s nomination to take on Mr Trump next year.

The inspectors’ report, based on visits to five facilities in Texas’s Rio Grande valley, found that children had few spare clothes, no laundry facilities and insufficient to eat. It also said many of the centres were extremely overcrowded.

Donald Trump promises tanks for Fourth of July parade

“At one facility, some single adults were held in standing-room-only conditions for a week, and at another, some single adults were held more than a month in overcrowded cells,” it said.

“We are concerned that overcrowding and prolonged detention represent an immediate risk to the health and safety of DHS agents and officers, and to those detained.”

The inspectors said in addition to holding roughly 30 per cent of minor detainees for longer than 72 hours, the facilities struggled to meet other federal standards.

“For example, children at three of the five border patrol facilities we visited had no access to showers,” it added. “While all facilities had infant formula, diapers, baby wipes, and juice and snacks for children, we observed that two facilities had not provided children access to hot meals – as is required.”

Mr Trump has doubled down on his position over immigration as he kicks off his reelection campaign, aware that few issues more energise his base.

This week, a congressional delegation visited a detention centre operated by the border patrol agency in Clint, Texas, where hundreds of children were moved after it was revealed they were living in very poor conditions.

Among those to visit was congresswoman Alexandria Ocasio-Cortez, who accused border agents of conducting “psychological warfare” against detained migrants. She said they had told her they were told to drink water from toilets if they were thirsty.