More than 60,000 family "units" — which the U.S. government defines as a parent and child — were stopped along the border in the 2014 fiscal year, a fourfold increase from a year earlier. In the last fiscal year, that number exceeded 70,000.
Initially, the Obama administration released mothers and children with notices to appear in immigration courts in the cities where they were headed. At times, immigrants were transported from Texas to Border Patrol facilities in other states so agents could keep up with ballooning arrivals.
The Obama administration then moved to hold mothers with children in family detention facilities — a 100-bed center in Pennsylvania and two larger facilities that opened in Texas in 2014. Those spaces provided a few thousand beds.
Immigrant advocates opposed the move, arguing that minors couldn't be kept for long periods in these facilities because of a 1997 settlement agreement governing the treatment of immigrant children. A federal judge in Los Angeles agreed and ruled that the children could not be kept in detention.
At the same time, the Obama administration faced criticism when photos of children in cages at a Nogales, Arizona, facility became front-page news — reminiscent of what happened last week when similar images came out of Texas.
Republican critics blamed the crisis on Obama immigration policy and the administration launched public relations campaigns in Central America to warn people to not make the journey. The crisis became a big campaign issue in midterm races in border states like Arizona.
After the federal ruling, the government started releasing many families more quickly since short detention stints would neither deter immigrants from coming nor give immigration courts enough time to evaluate asylum claims, said Seth Stodder, a former assistant secretary of homeland security for border, immigration and trade policy in the Obama administration.
The U.S. government could erect more detention facilities, Stodder said, but resolving asylum claims quickly isn't so easy since immigration courts are backlogged with hundreds of thousands of cases and immigrants often need time to obtain evidence from their countries.
"It is less about whether there is space to put people. They can find space to put people. The real issue is legal," he said, adding that ankle bracelets or monitoring programs might help ensure immigrants show up for court without the need for continued detention.
The Trump administration has sought to deter immigration through a "zero-tolerance" policy announced in April that mandated the criminal prosecution of all immigrants caught at the border. Authorities began jailing the parents and sending their children to government-contracted shelters, sparking an outcry from immigrant advocates and many lawmakers.
After separating more than 2,300 children from their parents, the administration shifted course this week and said families would be detained together. Officials filed a request to change the rules governing the detention of children under the court settlement — a move that advocates for the children said they would oppose.
Another challenge the administration faces stems from claims by many of these immigrants that they are fleeing violence and persecution in their countries. After initial screenings, they may proceed in many cases to seek asylum.
A recent decision by Attorney General Jeff Sessions to narrow the scope of asylum cases based on gang or domestic violence might result in cases moving quickly. But Stodder said doing so could also lead to more appeals and possibly more challenges of immigration rulings in the federal courts.
"Due process will be had," he said. "The question is whether it is in the immigration courts or whether it is in the circuit courts."
Associated Press Writer Colleen Long in Washington, D.C., contributed to this report.