The Trump administration’s sweeping immigration crackdown faltered Wednesday after GOP leaders watched members of their party help defeat a border bill championed by the president and a federal judge ordered the government to swiftly reunite migrant families.

By a vote of 301 to 121, the House rejected a wide-ranging GOP immigration bill that would have funded President Trump’s border wall, offered young undocumented immigrants a path to citizenship and partially addressed the family-separation crisis at the southwest border.

The vote came hours after the president tweeted that the House should pass the bill to “SHOW THAT WE WANT STRONG BORDERS & SECURITY.”

After weeks of negotiations between GOP conservatives and moderates, the vote made clear how split the party remains on the issue. The measure barely won a majority of Republican lawmakers, and with no Democrats voting for it, the bill went down in a lopsided defeat.

Lawmakers will leave for a 10-day Fourth of July recess, taking no action amid an uproar over the separation policy and images of migrant children held in chain-link detention pens.

At the same time, administration officials scrambled Wednesday to craft a response to a federal judge in San Diego who late Tuesday ordered the government to quickly reunite migrant children with their parents.

Judge Dana M. Sabraw granted a preliminary injunction sought by the American Civil Liberties Union, saying all migrant children separated from their parents must be returned to their families within 30 days, allowing just 14 days for the return of children under age 5. He also ordered that parents be allowed to speak by phone with their children within 10 days.

Secretary Kirstjen Nielsen and other top Department of Homeland Security officials have repeatedly insisted that the country’s immigration impasse requires urgent legislative attention. But the country’s border security and immigration agencies now find themselves pressed by Trump’s June 20 executive order and the new court order to reunite the migrant families they have spent the past six weeks pulling apart.

The administration had touted its “zero-tolerance” initiative as the definitive end of what Trump has called “catch and release” practices at the border that generally allow parents who cross illegally with children to avoid being held in immigration detention while awaiting court hearings.

The judge’s ruling ordering the government to give migrant parents their children back could mean the vast majority will be released with an ankle monitoring device or some other alternative to detention, because the government’s capacity to hold families together in custody is limited.

Immigration and Customs Enforcement has two large “family residential centers” in Texas and a smaller one in Pennsylvania, with a combined capacity of about 3,000 beds. But those facilities are nearly full, and DHS officials acknowledge that the practical implication of the judge’s ruling ordering the migrant children’s return will be something akin to “reunite and release.”

One glimpse into the government’s expansion plans came Wednesday evening, as the Defense Department notified lawmakers of a formal DHS request to house migrant families at military installations that could hold up to 12,000 migrants.

If such facilities are not available, the notice said, DHS will seek to set up family detention camps at three locations with enough tent space for 4,000. The agency has asked the Pentagon to be ready to accommodate the first 2,000 people within 45 days, the notice said.

DHS officials are looking to erect the sites in states along the border, in order to comply with court rulings that “reasonable efforts be made to place minors in the geographic area where the majority are apprehended,” according to the memo, sent to lawmakers by the Pentagon’s legislative affairs office.

A Justice Department spokesman declined to say whether the agency would appeal the judge’s injunction. An appeal would probably force a hearing in the coming days, which could delay the timeline laid out in the judge’s injunction, or scrap it entirely if the appeal was successful.

Teams of attorneys at the DHS, the Department of Health and Human Services and the Justice Department spent Wednesday analyzing the ruling and how the administration intends to respond.

Sabraw faulted the Trump administration for “a chaotic circumstance of the government’s own making.” He found the zero-tolerance policy begun in early May, and subsequent moves by the administration, marked a sharp departure from “measured and ordered governance, which is central to the concept of due process enshrined in our Constitution.”

The judge said that under the present system, migrant children “are not accounted for with the same efficiency and accuracy as property.”

The Justice Department said in a statement Wednesday that the decision “makes it even more imperative that Congress finally act to give federal law enforcement the ability to simultaneously enforce the law and keep families together.” The statement added: “Without this action by Congress, lawlessness at the border will continue, which will only lead to predictable results — more heroin and fentanyl pushed by Mexican cartels plaguing our communities, a surge in MS-13 gang members, and an increase in the number of human trafficking prosecutions.”

Trump officials say they fear the transnational gang, whose members the president calls “animals,” could take advantage of lax enforcement at the border. But critics say the administration uses a broad brush to criminalize asylum seekers and families seeking a haven in the United States. Homeland Security statistics do not indicate a large influx of underage gang members at the border. Of the nearly 5,000 border-crossers apprehended since 2012 who had suspected gang ties, only 159 were minors, DHS figures show. Of those, 56 were suspected or confirmed to be affiliated with MS-13.

Susan Reed of the Michigan Immigrant Rights Center, which represents separated and unaccompanied immigrant children being housed there, said that as of late Wednesday afternoon, the federal government had offered no new details about how it intends to comply with the court order to reunify families.

“No one in the system seems to think it is in any way their role to facilitate communication with the parent or with us,” Reed said, speaking of the border agents and ICE officials who are holding parents. “It’s incredibly difficult. It’s taking our very creative staff just a lot of banging on the phone lines and punching credit cards into collect-calling systems, and all the difficulties of communicating with incarcerated people.”

In his 24-page order, Sabraw ruled that children could be separated at the border only if adults with them were found to pose a danger to the children. He also said adults could not be deported from the country without their children.

Sabraw, 59, was nominated to the federal bench by President George W. Bush in 2003.

The lawsuit’s initial plaintiffs were a mother and her 6-year-old daughter who were split up after arriving in the United States in search of sanctuary from persecution in Congo. They arrived at the San Diego border in November, the suit alleges, at which point the “frantically screaming” child was taken to a facility in Chicago, while her mother, identified only as “Ms. L,” filed for asylum in California.

The pair were reunited in March, but the civil liberties group persisted with claims by other migrants.

The accounts of migrants in the suit, the judge wrote in granting the injunction, reveal “the separations at issue have been agonizing for the parents who have endured them.” Citing evidence of the long-term destabilizing impact on children of being separated from their parents, he further observed “irreparable injury” to parents and children alike would result from the administration’s current practices.

The government, Sabraw reasoned, “has an affirmative obligation to track and promptly reunify these family members.” He called it “startling” that the administration had not undertaken adequate planning before deciding to strip children from parents held for criminal prosecution. “There was no reunification plan in place, and families have been separated for months,” he wrote.


Migrant children walk outside at the Homestead Temporary Shelter for Unaccompanied Children, a former Job Corps site that now houses them, on June 22 in Homestead, Fla. (Brynn Anderson/AP)

Lee Gelernt, the ACLU’s head attorney in the case, welcomed the injunction.

“This ruling is an enormous victory for parents and children who thought they may never see each other again,” Gelernt said in a statement. “Tears will be flowing in detention centers across the country when the families learn they will be reunited.”

Gelernt said the judge’s injunction should force the government to swiftly reunite children with their parents. Reunification “is not an insurmountable task for the United States government,” he said. “If something is prioritized, it can get done.”

Tuesday’s judgment was issued the same day that Trump notched a victory in securing the Supreme Court’s endorsement of his authority to ban travelers from several majority-Muslim countries. The 5-4 decision ended a protracted legal struggle over one of Trump’s central campaign promises.

Just as one conflict came to a resolution, however, the injunction created fresh legal tumult on the newest front in Trump’s battle to remake the country’s immigration system, an effort vehemently resisted by a collection of blue states.

Earlier Tuesday, 17 states, including New York and California, sued Trump’s administration in an attempt to require federal officials to reunite families. While Trump’s executive order jettisoned separation as a prong of his zero-tolerance approach to immigration, it left in question the fate of the thousands of children who have already been taken from their parents.

On Monday, the nation’s top border security official confirmed that he ordered a suspension of prosecution referrals for adults who cross the border illegally with children, essentially freezing the family separation system that sent more than 2,500 minors into foster care between May 5 and June 20.

Kevin McAleenan, the commissioner of U.S. Customs and Border Protection, told reporters that migrant children will only be separated from adults who have prior criminal records, or if the child were at risk. Border agents will reman vigilant for cases of fraud and human trafficking, McAleenan said, particularly instances of adults traveling with children who are not their own in order to gain entry and avoid detention.

Emma Brown contributed to this report.