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 filthy conditions at one of the agency's stations in Texas.

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.

The Trump administration is dealing with unprecedented numbers of migrant families coming across the border, a surge that has left detention centres severely overcrowded and taxed the government's ability to provide medical care and other attention.

The 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, and older children trying to care for toddlers.

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.

In an interview with AP last week, Sanders blamed the problems in detention on a lack of funding. He called on Congress to pass a $4.5 billion emergency funding bill to address the crisis - legislation the House was planning to take up Tuesday.

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.

ICE on Saturday delayed a long-planned operation to sweep U.S. cities and arrest hundreds of people accused of flouting orders to leave the country, days after Trump's tweets about the operation alarmed immigrant families and advocates. 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.

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.

Many children were moved out of the facility in recent days. But around the same time that Sanders announced his resignation, his agency said officials had moved more than 100 children back to the station.

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.

Clara Long, a senior researcher with Human Rights Watch, and other lawyers inspected the facilities because they are involved in the Flores settlement, a Clinton-era legal agreement that governs detention conditions for migrant children and families.

The lawyers spoke to children who contradicted CBP's claims that the agency provides regular meals, safe places to sleep and access to medical care.

CBP's facilities at the Mexican border were almost all built when most people crossing the border 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.

Six children have died since last year after being detained by border agents. At least two are believed to have died of complications of the flu, including a 16-year-old who was left to sleep on a concrete bench inside a Border Patrol station.

“The death of a child is always a terrible thing, but here is a situation where, because there is not enough funding ... they can't move the people out of our custody,” Sanders said.