WASHINGTON - President Donald Trump said Wednesday that he is preparing to sign an executive order to halt the separation of migrant children from their parents on the US border, as global criticism of the practice mounted.

The announcement came after his administration was besieged from all sides over the policy, launched in early May, to arrest anyone crossing the border illegally.

That crackdown sent the adults for prosecution as criminals - and removed their children from their care, sending them to tent camps and other facilities where they were unable to contact their loved ones.

As images and accounts of sobbing children wrested from their parents circulated, Trump’s own Republican Party began to rebel, prompting him to do an about-face after days of saying it was up to Congress to act, and pledge executive action.

“We want security for the country,” Trump said at a meeting with Republican lawmakers at the White House. “And we will have that at the same time we have compassion, we want to keep families together.”

“We are signing an executive order in a little while” to end the practice, Trump said. The president however made clear he was not easing up on his determination to shut down the border to illegal immigration, calling it a source of rampant crime and drugs.

“We still have to maintain toughness, or our country will be overrun by people, by crime, by all of the things that we don’t stand for and we don’t want,” he said.

As countries marked World Refugee Day Wednesday, British Prime Minister Theresa May, Canadian Prime Minister Justin Trudeau, the Council of Europe and Pope Francis all took issue with Trump’s “zero tolerance” policy.

May said images of migrant children kept in cage-like units were “deeply disturbing,” and the Council of Europe, a global human rights watchdog, said Trump had abdicated any claim to moral leadership in the world.

“A person’s dignity does not depend on them being a citizen, a migrant, or a refugee. Saving the life of someone fleeing war and poverty is an act of humanity,” the pope said on Twitter.

Trump continued to blame opposition Democrats and the media for the crisis on the southern US border.

After a downturn last year, since October, the number of migrants seeking to cross the southwest US border from impoverished Guatemala, El Salvador and Honduras, as well as from Mexico, has surged.

From March to May this year, more than 50,000 people a month were apprehended for illegally crossing the border from Mexico. About 15 percent of those are arriving as families, and eight percent as unaccompanied children. Nearly all of the families, and many others, are officially asking for asylum, citing the incessant violence in their home countries. Aiming to deter more arrivals, in early May, the Trump administration announced it would arrest and criminally charge all adults.

Meanwhile, any children entering the country with them, including infants, would be taken away and held separately. The issue has stuck an emotional chord, amid accounts of children screaming and crying in the tent camps prepared for them in southern Texas.

“We were outside, and you could hear voices of children that appeared to be playing or laughing, but when they opened the door, we saw around 20 to 30 10-year-old boys in one of these chain-link enclosures, and they were crying and screaming and asking for their mothers,” pediatrician Marsha Griffin told AFP in El Paso. The government has said the families could be reunited eventually after the parents were processed in court.

But on Tuesday, a top official from the Department of Health and Human Services, charged with caring for more than 2,300 such children taken since May 5, admitted they have no system in place to do so.

Ahead of Trump’s statement, House of Representatives Speaker Paul Ryan said the House will vote Thursday on legislation that will stop the family separation.

“We don’t think families should be separated, period. We’ve seen the videos, heard the audio,” Ryan said.

Under the legislation, Ryan said, “We are going to take action to keep families together while we enforce our immigration laws.”

But it wasn’t clear that the Republican bill, which includes other key immigration law changes, would pass, possibly precipitating Trump’s action.