President Trump signed an order Wednesday ending the separation of families at the border, moving to end a crisis that engulfed his administration and threatened to derail his hopes of progress on broader immigration reforms.

The changes don’t end the new zero-tolerance policy that pushes for criminal prosecutions of illegal immigrants who jump the border — indeed, it enshrines the policy in the executive order.

But it does mean those families arrested for sneaking in will be held in immigration detention facilities, rather than separated, with parents sent to criminal justice system jails and kids handed off to Health Department-run dorms.

SEE ALSO: Disturbing TV images prompted Trump’s abrupt reversal on family separations

“What we have done today is we are keeping families together. The borders are just as tough, just as strong,” Mr. Trump said in the Oval Office as he signed the order, flanked by Vice President Mike Pence and Homeland Security Secretary Kirstjen Nielsen.

It’s not clear what the order means for the more than 2,300 children who were already separated. The government has been unable to say how many of them were already reunited, and couldn’t say Wednesday what will happen now in those cases.

And much of the success of the order depends on being able to hold families in detention longer than 20 days — which will require overturning a 2015 court case that imposed the 20-day limit. Mr. Trump ordered Attorney General Jeff Sessions to ask the court to revise its ruling, and he urged Congress to step in and pass legislation to solve the matter once and for all.

“This is a stopgap measure. The president’s doing everything he can here within the bounds of existing authority,” said Gene Hamilton, a senior aide to Mr. Sessions.

But immigrant-rights groups were furious, saying that while they didn’t want children separated from families, neither did they want families to be detained.

“Family incarceration is not the answer to ending family separation, and moving children from one cage to another is an outrage,” said Neera Tanden, president of the Center for American Progress, a leading liberal think tank.

Indeed, Mr. Trump’s decision Wednesday seemed to rip the bandaid off the immigration fight, exposing the scabs of years of stalemate.

On one side was the administration and many Republicans, who argued that people who come to the country illegally should be quickly deported, and the only way to ensure that is to hold them in detention, which makes sure they show up for their hearings.

Opposing Mr. Trump are Democrats and immigrant-rights groups that argue many of the illegal immigrants should be treated as refugees, should not be held in detention, and should be given government-funded lawyers to help them argue their cases for why they should be allowed to stay.

Signing the order marked a major retreat for the president, who for the last week had blamed Democrats for the separations and said it would take a change in law to stop it.

On Wednesday, Mr. Trump talked about the “dilemma” he felt he was facing.

“The dilemma is that if you’re weak — like some people would like you to be — if you’re really, really pathetically weak, the country’s going to be overrun with millions of people,” Mr. Trump said. “And if you’re strong, then you don’t have any heart. That’s a tough dilemma. Perhaps I’d rather be strong, but that’s a tough dilemma.”

The crux of the zero-tolerance policy is using the criminal code to try to deter illegal immigration. For decades, it’s been a crime to jump the border — though past administrations used those provisions only sparingly.

The Trump administration has said it wants nearly 100 percent prosecutions.

Currently those charged with crimes are supposed to be held by the Justice Department, whose jails are not equipped for family custody. Homeland Security does have some family detention facilities, but they are used for people in the immigration system, not the criminal justice system.

House Republicans’ new immigration bill, expected to be voted on Thursday, includes a provision that would write into law the ability for the government to keep migrants in criminal proceedings in Homeland Security facilities.

The House bill would only apply to parents charged with misdemeanors. Those with felony charges, such as smuggling or reentering the country after a previous deportation, would still go to the Justice Department under the House plan.

Keeping families together in Homeland Security detention will likely require an infusion of cash to create more family detention space.

Mr. Trump ordered the Defense Department and other federal agencies to offer whatever space they could.

The Obama administration, which faced its own surge of illegal immigrant families in 2014 and 2015, tried to open family detention centers but was met with fierce opposition by immigrant-rights advocates who said it was cruel to keep families detained.

They renewed those objections Wednesday.

“Even if families are detained together, it is just as harmful as family separation,” said America’s Voice, a leading advocacy group, citing psychologists.

The number of families surging toward the U.S. has increased dramatically this year. Activist groups say they’re fleeing horrific conditions back home, while Mr. Trump says they’re being enticed to the U.S. by “loopholes” and other lax policies, realizing that if they can show up with children they’ll be quickly released and can disappear into the shadows with the 11 million other illegal immigrants already here.

That spurred the zero-tolerance policy, which kicked in fully in early May.

Homeland Security officials said that from May 5 through June 9 they arrested 4,538 people who snuck into the U.S. traveling as families and who faced separation. That included 2,206 adults who were prosecuted and sent to jail to await their proceedings, leaving 2,342 juveniles as Unaccompanied Alien Children who had to be stuck in government-run dorms.

Usually the adults serve a few days in jail, plead guilty to illegal entry charges, are sentenced to the time they already served, and are released back into the immigration system.

Senate Republicans on Wednesday introduced a bill that would try to permanently stop family separations by allowing them to be kept together in Homeland Security facilities for a longer period of time. The legislation would set mandatory conditions for the family detention centers, and it would also try to shorten the time immigration cases take by adding more judges and giving priority to these cases.

The GOP bill, combined with Mr. Trump’s move, puts the focus back on Democrats.

They were conflicted.

Senate Minority Leader Charles E. Schumer said Mr. Trump made the right move — and said he hoped the administration would move quickly to reunite the more than 2,000 children already taken from parents.

But his top lieutenant, Sen. Dick Durbin, blasted Mr. Trump and demanded he end detention altogether for the families in question.

“Locking up whole families is no solution at all — the Trump administration must reverse its policy of prosecuting vulnerable people fleeing three of the most dangerous countries on earth, who are attempting to seek safe haven in America,” the Illinois Democrat said.