Media playback is unsupported on your device Media caption Donald Trump: "You're going to have a lot of very happy people"

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.

But the order does not address families already separated by the policy.

US immigration officials say 2,342 children were separated from 2,206 parents between 5 May and 9 June.

"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.

More on child migrants crisis

The executive order calls for:

Immigrant families to be detained together while their legal cases are considered

Expediting immigration cases involving families

Requesting the modification of a court ruling that dictates how long immigrant children can be detained

The president said his wife, Melania, and daughter, Ivanka, who reportedly have been applying pressure on him to drop the policy, "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 the signing of the order on Wednesday.

Media playback is unsupported on your device Media caption US youth shelter worker quit after being ordered to separate siblings

Before his U-turn on Wednesday the president had previously said "you can't do it through an executive order", insisting that only Congress could fix the policy by passing immigration reform.

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.

Media playback is unsupported on your device Media caption The sound of migrant children separated from parents

Pictures of dozens of children sleeping in fenced enclosures and audio of them crying emerged in recent days, provoking widespread criticism.

Under previous US administrations, immigrants caught crossing the border for the first time tended to be issued with court summonses and released.

Six American airlines have told the Trump administration not to use their aircraft to transport child migrants who have been separated from their parents.

Alaska, American, Delta, Frontier, Southwest and United airlines all said the policy contravened their values.

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.

Media playback is unsupported on your device Media caption Migrant boys detained in a former Walmart in Texas

"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".

Media playback is unsupported on your device Media caption The US teens training in border patrol

What happens now?

Mr Trump's order says that families could remain together in detention instead of separating children from parents illegally crossing into the country.

But immigrant children are only allowed to be held for 20 days, according to a 21-year-old landmark court decision known as the Flores agreement.

The order also calls for the justice department to request to modify the Flores agreement to allow children to be held longer, but it is unclear what will happen if the law does not change.

Media playback is unsupported on your device Media caption The missing - consequences of Trump's immigration crackdown

The Trump administration is likely to become tangled in legal battles with immigration activists on behalf of detained migrants if it is unable to overturn the Flores agreement before the 20-day deadline.

"This is a stopgap measure," said Gene Hamilton, counsel to Attorney General Jeff Sessions.

The order also did not provide any date or timeline on when it would be implemented and does not address how the more than 2,000 children already stripped from their families would be reunited.

Health and Human Services (HHS) Secretary Alex Azar has said his department will begin working to return detained immigrant children to their families, but did not give a timeline.

A top HHS official told Agence France-Presse on Tuesday they have no system in place to do so.