President Donald Trump has backed down after widespread criticism of an immigration policy that split families at the US border, signing an executive order that will put a stop to the practice.

The issue has plagued his administration after it was revealed that at least 2,000 children had been torn from their parents under a new “zero tolerance” immigration policy.

Mr Trump said on Wednesday that the zero tolerance policy would continue, but that he “didn’t like the sight or the feeling of families being separated”.

The executive order, he said, was “about keeping families together, while at the same time being sure that we have a very powerful, very strong border”.

“I think the word ‘compassion’ comes into it, but it’s still equally as tough, if not tougher,” Mr Trump added. The day before, he had accused immigrants of “infesting” the country, and declared the US would not be a “refugee holding facility”.

Family separations have escalated under Mr Trump’s new zero tolerance policy, which requires all adults caught crossing the border illegally to be referred for prosecution. Adult immigrants facing charges are housed separately from their children, resulting in the separation of parents from children reportedly as young as eight-months-old.

Screaming children heard crying for parents at US detention centre after being separated at border under Trump policy, in distressing audio recording

But the president’s new executive order states that the US’s policy is to “maintain family unity”, except in cases where doing so would threaten a child’s wellbeing.

In the order, Mr Trump directed the secretary of homeland security to house those facing prosecution alongside their family members, “to the extent permitted by law and subject to the availability of appropriations”. He ordered the secretary of defence to identify any existing facilities for housing immigrant families, and to build more if necessary.

Mr Trump also directed the attorney general to request a modification of the Flores Settlement Agreement – a 2015 court ruling that the administration has claimed bars them from housing families together. It was unclear how the new executive order will square with the ruling, which requires migrant children to be released quickly from detention, or detained in the “least restrictive conditions” possible.

The president denied allegations that he was backing down from his strict stance on immigration, telling reporters at the signing that the southern border was “just as tough” as before.

Undocumented immigration across the US-Mexico border Show all 14 1 /14 Undocumented immigration across the US-Mexico border Undocumented immigration across the US-Mexico border Immigrant children, many of whom are separated form their parents, are housed in Texas' tent city Reuters Undocumented immigration across the US-Mexico border A two-year-old Honduran asylum seeker cries as her mother is searched and detained near the US-Mexico border Getty Undocumented immigration across the US-Mexico border Undocumented migrants ride on the top of a freight train referred to as the beast, or La Bestia Getty Undocumented immigration across the US-Mexico border A cage inside a US Customs and Border Protection detention facility in Texas Reuters Undocumented immigration across the US-Mexico border US Border Patrol Academy All new agents must complete a months-long training course at the New Mexico facility before assuming their posts at Border Patrol stations, mostly along the US-Mexico border Getty Undocumented immigration across the US-Mexico border US-Mexico border fence A group of young men walk along the Mexican side of the US-Mexico border fence in a remote area of the Sonoran Desert Getty Undocumented immigration across the US-Mexico border US-Mexico border fence in the US Man looks through US-Mexico border fence into the US in Tijuana, Mexico Getty Undocumented immigration across the US-Mexico border US-Mexico border fence US Border Patrol agent Sal De Leon stands near a section of the US-Mexico border fence while stopping on patrol on in La Joya, Texas Getty Undocumented immigration across the US-Mexico border US Border Patrol Academy US Border Patrol instructor yells at trainees after their initial arrival to the academy Getty Undocumented immigration across the US-Mexico border Memorial service in Guatemala Families attend a memorial service for two boys who were kidnapped and killed in San Juan Sacatepequez, Guatemala. Crime drives emigration from Guatemala to the United States, as families seek refuge from the danger Getty Undocumented immigration across the US-Mexico border Arrests on the border Undocumented immigrants comfort each other after being caught by Border Patrol agents near the US-Mexico border Getty Undocumented immigration across the US-Mexico border Detention holding facility A boy from Honduras watches a movie at a detention facility run by the US Border Patrol Getty Undocumented immigration across the US-Mexico border Mexican farm workers Mexican migrant workers harvest organic parsley at Grant Family Farms in Wellington, Colorado Getty Undocumented immigration across the US-Mexico border Mexican family in Arizona A Mexican immigrant family sits in the living room of their rented home in Tuscon, Arizona. The family that Arizona's new tough immigrant law had created a climate of fear in the immigrant community. Getty

A spokesman for Health and Human Services, which oversees the resettlement of migrant children, told multiple outlets on Wednesday that the more than 2,000 children already separated from their parents would not be immediately reunited under the new order. Kenneth Wolfe, a spokesman for the Administration for Children and Families (ACF), told the New York Times there would be no "grandfathering of existing cases".

But another official later claimed Mr Wolfe had misspoken, saying the department was still "awaiting further guidance on the matter".

"It is still very early," Brian Marriott, the senior communications director at ACF, said in a statement. "Our focus is on continuing to provide quality services and care to the minors...and reunifying minors with a relative or appropriate sponsor as we have done since HHS inherited the program."

Still, immigrants' rights activists criticised the order, saying it did not address the larger issues concerning the zero tolerance policy. The executive order, they pointed out, only solved the problem of family separations by requiring parents and children to be detained together for an indefinite amount of time.

“Make no mistake – this executive order is a betrayal of families fleeing violence and persecution,” said Denise Bell, a refugee and migrant rights researcher at Amnesty International USA. ”Mothers, fathers, and children must not be held behind bars for prolonged periods for seeking safety.”

The order came after weeks of backlash, as video circulated of families being housed in large metal cages and children crying after being taken from their parents. The Associated Press reported the night before that the administration had set up three “tender age” shelters to house young children – many under the age of 5.

“Then they wake up from their naps and again they’re crying for their mom, asking: ‘Where’s my dad’,” said Chris Paulsey, the CEO of the largest agency handling young migrant children in the US. “They absolutely need their parents right now.”

Human rights groups, religious organisations, and legislators across the political spectrum have called for the end of family separations. Several states pulled their National Guard troops from the US-Mexico border this week, and New York Governor Andrew Cuomo announced plans to sue the federal government.

The Trump administration has blamed Congress for the separations, claiming they are the result of loopholes in federal immigration laws. Secretary of homeland security Kirstjen Neilsen also blamed immigrant parents for the problem, saying in a press briefing on Monday that “by entering our country illegally, often in dangerous circumstances, illegal immigrants are putting their children at risk”.