US President Donald Trump has bowed to public pressure and signed an executive order promising to “keep families together” in migrant detentions.
Mr Trump reversed his own policy amid international fury over the separation of undocumented parents and children.
He said he had been swayed by images of children who have been taken from parents while they are jailed and prosecuted for illegal border-crossing.
It was not immediately clear when Mr Trump’s order would be implemented.
“It’s about keeping families together,” Mr Trump said at the signing ceremony on Wednesday.
“I did not like the sight of families being separated,” he said, but added the administration would continue its “zero tolerance policy” of criminally prosecuting anyone who crosses the border illegally.
The executive order states that immigrant families will be detained together, except in cases where there are concerns about the child’s welfare, but it is unclear for how long.
Mr Trump’s order also calls for prioritising immigration cases involving detained families.
The president said his wife, Melania, and daughter, Ivanka, who reportedly have been applying pressure on him to drop the policy in recent days, “feel strongly” about ending the practice of separating migrant families.
“I think anybody with a heart would feel very strongly about it,” he said. “We don’t like to see families separated.”
Vice-President Mike Pence and Department of Homeland Security Secretary Kirstjen Nielsen, who has emerged as the face of the White House policy, were both present for Wednesday’s order signing.
Republican congressional leader Paul Ryan said the House of Representatives will vote on Thursday “on legislation to keep families together”.
He did not immediately provide details of the bill, but said it resolves the issue of so-called Dreamers, undocumented adult migrants who entered the US as children, “in a very elegant way”.
Trump backs down
Analysis by Anthony Zurcher, BBC News, Washington
For days administration officials have insisted they were simply following the law as written and their “zero tolerance” policy for illegal border crossings meant they “have to take the children away”, in the president’s words.
Critics have countered that Mr Trump unilaterally created the situation that produced the heart-rending accounts of children separated from their parents, and he could unilaterally fix it.
By taking executive action, the president is effectively acknowledging they were correct.
Now the fight will probably move to the courts, with legal challenges to the administration’s decision to hold detained families together while their immigration status is adjudicated.
That is more politically hospitable ground for Republicans, who already face challenging mid-term congressional elections.
Read more of Anthony Zurcher’s analysis
Why the uproar?
In April, the US attorney general announced a “zero-tolerance” policy to criminally charge and jail undocumented border crossers.
As children cannot legally be jailed with their parents, they are kept in separate facilities.
US immigration officials say more than 2,300 children have been taken from some 2,200 parents since 5 May.
Pictures of dozens of children sleeping in fenced enclosures and audio of them crying emerged in recent days, provoking the widespread criticism.
Under previous US administrations, immigrants caught crossing the border for the first time tended to be issued with court summonses and released.
Where are the children taken?
Holding cells: They are first detained at Customs and Border Protection (CBP) facilities, where chain-link fenced enclosures are used, though the children can only be legally held there for three days.
Detention centres: They are then supposed to be moved to one of around 100 detention centres run through the Office of Refugee Resettlement (ORR), part of the Department of Health and Human Services. US officials recently showed reporters around a converted Walmart Supercenter in Texas which was housing migrant boys aged 10-17. They apparently had access to beds, classes and games.
“Tender age shelters”: AP news agency reports that babies and toddlers are being taken to three “tender age shelters” in southern Texas. A CBP official said it is up to the discretion of border agents whether to detain “tender-aged” children, who are typically less than five years old.
Tent camps: US officials have set up a tent camp for migrant children in Tornillo, Texas.
Family members: Under US law, the children are meant to be released to stay with relatives or foster carers “without delay”. In practice, the ORR says this process takes about two months.
How are they reunited? Immigrations and Customs Enforcement (ICE) has set up a hotline for parents to call after they are released from custody. However, a former ICE director has said some family separations are “permanent”.
What has global reaction been?
The UK and Canadian prime ministers, Theresa May and Justin Trudeau, both called it “wrong”.
Pope Francis said he supported US Catholic bishops who described it as “immoral”.
French far-right leader Marine Le Pen, who in the past has praised Mr Trump’s policy of curbing immigration, told French TV that she disagreed with splitting children from parents.