HOUSTON -- The acting head of U.S. Customs and Border Protection resigned Tuesday amid an uproar over the discovery of migrant children being held in pitiful conditions at one of the agency's stations in Texas.

Acting Commissioner John Sanders' departure deepened the sense of crisis and added to the rapid turnover inside the agencies responsible for enforcing President Donald Trump's hardline immigration priorities as the U.S. deals with record numbers of migrant families coming across the border.

In a message to employees, Sanders said he would step down on July 5. He did not give a reason for leaving.

"Although I will leave it to you to determine whether I was successful, I can unequivocally say that helping support the amazing men and women of CBP has been the most fulfilling and satisfying opportunity of my career," he said.

Hours after Sanders' departure became public, two officials told The Associated Press that he was being replaced by Mark Morgan, who was named acting director of U.S. Immigration and Customs Enforcement just last month. The officials were not authorized to speak publicly about the move and declined to be identified.

In an interview last week, Sanders blamed the problems in detention on a lack of money and called on Congress to pass a $4.5 billion emergency funding bill to address the crisis. The House approved the legislation on Tuesday night, setting up a showdown with the Senate where Republican leaders plan approval of a different, bipartisan bill this week that does not offer as many protections and services for migrants.

At the White House, Trump said that he did not ask for Sanders' resignation -- adding that he doesn't think he has ever spoken to the man -- but that he is "moving some people around into different locations" amid the crisis.

While activists welcomed Sanders' departure, Trump defended U.S. border authorities, saying, "The laws are so bad and the asylum rules and laws are so bad that our Border Patrol people, who are so incredible, aren't allowed to do their jobs."

The unprecedented surge of migrant families has left U.S. immigration detention centres severely overcrowded and taxed the government's ability to provide medical care and other attention. Six children have died since September after being detained by border agents.

After he was picked to lead ICE, Morgan, the new acting director, showed a willingness to deport families during enforcement sweeps. However, past Trump immigration officials hesitated over concerns about logistics and the public's reaction.

The Trump administration has faced a barrage of criticism in recent days over conditions inside the Border Patrol facility in Clint, Texas, first reported by The Associated Press: inadequate food, lack of medical care, no soap, and older children trying to care for toddlers.

In one case reported in Clint, attorneys said a 2-year-old boy without a diaper was being watched by older children. Several youngsters had the flu. Many were separated from extended family members like aunts and uncles who brought them to the border; others were teenage mothers with babies.

As word of the children's plight got out, people moved by their stories started showing up the station's doors to donate boxes of diapers and even a Cookie Monster stuffed toy.They were not allowed in the building. Customs and Border Protection says it has enough supplies, but was checking with lawyers to see if it could accept donated items.

"On just a gut level I see myself, I see my family, I see my neighbours, I see my students in these migrants," said Diego Carlos, who teaches social studies at an El Paso high school and joined a small protest outside the station.

"Literally, I have students who come over from the border almost every day to go to school at the school I teach," Carlos added.

An official from Customs and Border Protection said Tuesday that the majority of the roughly 300 children detained at Clint last week had been moved to facilities operated by the Office of Refugee Resettlement. The official, who briefed reporters on the condition of anonymity, wouldn't say exactly how many.

But around the same time Sanders announced his resignation, his agency said officials had moved more than 100 children back to the station.

The human costs of the migrant surge were driven home this week by a searing photo of the bodies of a Salvadoran man and his nearly 2-year-old daughter, face down in shallow water along the Mexican side of the Rio Grande. On Sunday, two babies, a toddler and a woman were found dead on the Texas side, overcome by the sweltering heat.

Trump said he is "very concerned" about conditions at the border but claimed without evidence that things are "much better than they were under President Obama, by far" and in "much better shape than it ever was" -- an assertion immigration activists said is simply not true.

"We did not have the kind of overcrowded conditions for unaccompanied kids in Border Patrol holding cells like we saw in Clint," said Michael Bochenek, a lawyer from Human Rights Watch.

Previously CBP's chief operating officer, Sanders was named acting commissioner in April after the agency's previous leader, Kevin McAleenan, became acting secretary of the Department of Homeland Security. Other key DHS agencies also have interim or acting directors, including U.S. Immigration and Customs Enforcement and U.S. Citizenship and Immigration Services.

Morgan, who also served as chief of the Border Patrol, a subsidiary of CBP, under President Barack Obama, is now expected to be replaced as ICE's acting leader by Matthew Albence. Albence served as acting director earlier this year after the departure of another former leader, Ronald Vitiello.

ICE on Saturday delayed an operation to sweep U.S. cities and arrest hundreds of people accused of flouting orders to leave the country, days after Trump tweeted about the upcoming crackdown. Former ICE acting director Thomas Homan, a Trump administration ally, then went on television to accuse McAleenan of leaking information about the operation because he opposed it.

CBP is the agency that apprehends and first detains migrant parents and children crossing the Mexican border.

CBP's facilities at the border were almost all built when most people crossing into the U.S. illegally were single adults. Now, the agency is apprehending tens of thousands of parents and children weekly. It recorded 84,500 apprehensions of adults and children travelling together in May.

In the wake of Sanders' resignation, Democratic Rep. Bennie G. Thompson of Mississippi, chairman of the House Homeland Security Committee, lashed out at the administration's immigration policies and "bad actors in the White House."

"There is simply no excuse for the horrific conditions children and families are being held in at the border," he said.

Jennifer Quigley, director of refugee advocacy for Human Rights First, called on Congress to hold hearings on the youngsters' treatment.

"Trump administration officials need to be held accountable for the disgraceful response to the situation at the border," she said in a statement. "This is only the tip of the iceberg. We need a full accounting of how children came to be caged in filthy and unsafe conditions."

------

Associated Press journalists Jill Colvin and Colleen Long in Washington, and Cedar Attanasio in El Paso, Texas, contributed to this report.