Washington (CNN) President Donald Trump on Wednesday reversed course after days of digging in on a policy that resulted in immigrant family separations at the border, signing an executive order that will keep far more families together at the border.

The order also seeks more authority to detain those families together until the end of their immigration proceedings. That process will begin immediately, which is likely to be met with swift legal challenges, though the order does acknowledge that current law may restrict their hands.

But there are no new special procedures for children already in custody, according to the Department of Health and Human Services.

It's a reversal from days of claiming that, in its decision to refer all adults crossing the border illegally for criminal charges and thus sending them away from their kids and into the hands of the Justice Department, the administration had no choice but to separate families.

Here is what the executive order does:

Keeps families together, for the most part

The executive order states it is the policy of the administration "to maintain family unity," a new position from the administration which had been defending the separation of families and blaming the families themselves for putting themselves in the position of being separated by crossing the border illegally -- saying the administration's hands were tied.

While the Justice Department will continue to prosecute adults who cross the border illegally in federal court, the order says, Trump asks that families be housed together "where appropriate and consistent with law and available resources."

It was not immediately clear whether the caveats would still result in a substantial number of separations.

Keeps families with DHS

In a major change, adults will not be turned over to the Justice Department when they face criminal charges, and will instead stay with their children in detention with the Department of Homeland Security.

That's a change the administration previously said it could not do.

The order maintains an exception for when the child is at risk or there is concern about the child's well-being.

But there's a catch, saying the families will be detained "extent permitted by law and subject to the availability of appropriations" -- again something that remains to be worked out.

Doesn't reunite families already separated

The order does not speak to any families that have already been separated -- and existing policies place the onus on parents to find their children in HHS custody and seek to reunite with them.

On Wednesday afternoon, HHS spokesman Kenneth Wolfe said, "For the minors currently in the unaccompanied alien children program, the sponsorship process will proceed as usual."

Later Wednesday, HHS' families division's senior director of communications put out a statement that Wolfe "misspoke," but didn't articulate any changes yet to plans for separated families.

"It is still very early and we are awaiting further guidance on the matter," Brian Marriott said. "Our focus is on continuing to provide quality services and care to the minors in HHS/ORR funded facilities and reunifying minors with a relative or appropriate sponsor as we have done since HHS inherited the program. Reunification is always the ultimate goal of those entrusted with the care of UACs, and the administration is working towards that for those UACs currently in HHS custody."

Jumps families to the front of the line in court

In the order, Trump also makes an effort to have families' cases in immigration courts decided more rapidly.

Currently, if a family has a potentially valid claim of asylum, they could have an immigration court date months or years in the future, during which time they are allowed to live and work in the US.

In order to expedite the process for deporting the family or giving them legal status, Trump orders the Justice Department to "prioritize" cases "involving detained families" -- presumably jumping them in line at immigration court and cutting down substantially the length of time before a judge hears their case.

Seeks indefinite detention

Though the order does not immediately attempt to flout a court settlement that requires children who come with family to be released from detention within three weeks, it does initiate a process to challenge that settlement.

Trump ordered Attorney General Jeff Sessions to file a request in court to change the settlement in Flores v Reno -- setting up a likely lengthy and intense litigation process that would seek the power to detain families in government custody indefinitely.

The settlement, however, is overseen by a judge and an appellate court that already imposed these conditions, making the court challenge an uphill climb for the Trump administration. The administration will have to seek the change from the judge who oversaw the settlement -- over the objection of the previous administration -- in the first place.

"This is narrower than I anticipated," said Cornell Law professor Stephen Yale-Loehr. "Politically, this allows the administration to assert that it wants to detain families indefinitely -- but a court won't let them do it."

In a call with reporters, Gene Hamilton, counselor to the Attorney General, seemed to acknowledge that the administration will need to convince the judge in the Flores case, Judge Dolly Gee, to reverse the previous settlement -- even as he criticized her for making it in the first place.

"The result of this decision and this ruling has placed the executive branch in an untenable position. Do we catch and release every alien who comes with a child across our southwest border, or do we release (them)?" Hamilton said. "It's on the judge, it's on Judge Gee to render a decision here. ...The simple fact of the matter is Judge Gee has put the executive branch into an untenable position, that's why we're seeking for Congress to make a permanent fix."

Sets up family detention at military facilities

The order also instructs federal agencies -- especially the Defense Department -- to begin to prepare facilities that could house the potentially thousands of families that will now be detained by the government.

There are currently far more beds for single adults in the government than for families, who require different conditions.

With a few thousand families apprehended crossing the border illegally on average each month, detaining all of them could rapidly tax government resources.

HHS has reviewed three Defense Department locations in Texas and will be examining one in Arkansas for potential use in the Unaccompanied Alien Children program, Lt. Col. Jamie Davis, a Pentagon spokesman said.

The military would have no responsibility for any of the HHS-led activities, defense officials say. Officials liken it to being a 'landlord' but not responsible for the management of the housing, security, food services or other activities.

Blames Congress

The order also blames Congress -- specifically its failure to pass immigration legislation -- for the separation of families in the first place, saying the administration had no choice, even as the administration reversed course.

"It is unfortunate that Congress's failure to act and court orders have put the Administration in the position of separating alien families to effectively enforce the law," the order states.