The federal government on Tuesday began its first major wave of reuniting migrant children with their parents amid continued chaos, confusion and legal wrangling over when and how the rest of the thousands of families separated on the border would be brought back together.

The Trump administration said only 38 of 102 children younger than 5 had been reunited with their parents by the Tuesday deadline set by a federal judge in San Diego. The same judge has ordered that thousands of older children should be reunited by July 26.

Government attorneys said authorities were trying to comply with the order as quickly as possible, while attorneys for the immigrant families said the government could be doing more to speed up the reunifications.

Trump administration officials appeared to soften its hard-line stance on how the detainees are treated, saying the parents of children younger than 5 would largely be released with ankle monitors rather than being detained indefinitely as a family. They declined to say whether they would similarly release the parents of the much larger group of 2,000 to 3,000 children ages 5 to 17.

The administration’s move to rely on ankle monitors marks a return to the policy used before the administration began its method of separating parents and children caught illegally entering the country.

The shift followed an order issued Monday by a federal judge in Los Angeles, rejecting the Justice Department’s request to modify a long-standing legal settlement outlining how long immigrant minors may be detained.

The 1997 agreement, known as the Flores settlement, requires that minors be released “without unnecessary delay.”

In court Tuesday, Justice Department attorneys told the San Diego judge that they believed the two orders still allowed the administration to ask parents detained at the border to either waive the right to remain with their children, as recognized in the San Diego case, or waive the Flores settlement’s maximum 20-day limit that a child can be forced to spend in immigration detention.

Judge Dana Sabraw asked attorneys what happens if a parent doesn’t want to waive either right.

Lee Gelernt, an attorney for the American Civil Liberties Union, said the parent would have to file a separate lawsuit claiming lack of due process.

“We are hopeful the government will do the right thing,” Gelernt said.

Carlos Holguin, an attorney who represents immigrant minors in the Los Angeles case, said the administration was forcing parents to make a tough choice.

“The families are still in a very difficult position, either remain in custody together, or separate” so their children can be released, said Holguin, who offers counsel with the Center for Human Rights and Constitutional Law. “The government doesn’t have to do that. They can resume the policies and practices that were prevailing a year or two ago, release families together if they show credible fear of returning to the country of origin.”

Holguin said part of the difficulty for the administration appeared to be the dearth of facilities designed to detain families as a unit.

Across the country Tuesday, dozens of children were being allowed back into their parents’ arms after weeks apart as administration officials said they were doing their best to reunite families in a safe and expeditious way.

Three Honduran fathers in Grand Rapids, Mich., who were reunited with their children, two girls and a boy, were “just holding them and hugging them and telling them that everything was fine, and that they were never going to be separated again,” immigration lawyer Abril Valdes said.

Meanwhile, parents who remained separated from their older children remained in limbo, plagued with heartbreak and confusion.

Two Central American mothers, whose daughters are being held in South Texas shelters, said they were told reclaiming their girls from federal government-contracted shelters could take weeks and would require jumping through numerous bureaucratic hoops. Both asked to be identified by their first names only because their asylum cases are pending.

Janet, 46, and her 15-year-old daughter Jenny were detained crossing the Rio Grande on a smuggler’s raft in late May and separated from each other. Janet was released Monday with a notice to appear in court but has been unable to be with her daughter, who remains at a shelter in San Benito, Texas.

“So much time has passed. I want to take her with me. We’ll see if they give me the chance,” she said. Officials have told the volunteers helping her, with the nonprofit Grassroots Leadership, that in order to be reunited, she would have to clear a rigorous screening process, including fingerprinting and background checks.

Isabella, 40, hasn’t seen her 17-year-old daughter Diana since they swam across the Rio Grande 40 days ago near Hidalgo, Texas.

She was released Monday on $1,500 bond without an ankle monitor. A childhood friend drove from Maryland to help her find Diana. Her daughter, who she located at a Brownsville, Texas, shelter last week, has struggled psychologically with the separation, Isabella said.

“I’m praying to God to give me my daughter soon,” she said, adding that she hopes officials will be moved by the plight of the thousands of children still separated from their families. “I think this will touch the heart of the president.”

molly.hennessy-fiske @latimes.com

victoria.kim @latimes.com

Fawcett is a special correspondent. Times staff writer Brittny Mejia, Kristina Davis of the San Diego Union-Tribune and the Associated Press contributed to this report. Fawcett reported from Washington, Hennessy- Fiske from San Benito, Texas, and Kim from Los Angeles.