A federal judge in San Diego ordered immigration agents on Tuesday to stop separating migrant parents and children who have crossed the border from Mexico and to work to reunite families that have already been split up while in custody.

U.S. District Court Judge Dana Sabraw issued a preliminary injunction in a lawsuit filed by an anonymous woman from the Democratic Republic of Congo and backed by the American Civil Liberties Union, which pursued it as a class action as U.S. authorities began a "zero tolerance" policy in early May.

President Donald Trump issued an executive order to end the family separations last Wednesday, but the government has yet to reunite about 2,000 children with their parents.

Trump said last week that the order would "solve that problem" of children being separated from their parents, and government lawyers argued that he had "largely" addressed the issue. But Sabraw wrote that statements submitted by the government show that the order was intended to reunite families only "after the parent's immigration case is concluded" so they can "be deported together."

The order "is silent on the issue of reuniting families that have already been separated or will be separated in the future," he wrote.

Moreover, he wrote, "the record also reflects that the practice of family separation was occurring before the zero tolerance policy was announced, and that practice has resulted in the casual, if not deliberate, separation of families that lawfully present at the port of entry, not just those who cross into the country illegally."

And he zeroed in on a provision of the order intended to let the government continue to separate migrant families when "there is a concern that detention of an alien child with the child's alien parent would pose a risk to the child’s welfare."

Sabraw called that standard "subjective" and wrote, "Objective standards are necessary, not subjective ones, particularly in light of the history of this case"

The injunction orders immigration agents to:

Stop separating parents and children without an objective finding that a parent is unfit.

Reunify families with children under age 5 within 14 days.

Reunify families with children 5 years old and older within 30 days.

Let parents speak with their children by telephone within 10 days.

"The facts set forth before the court portray reactive governance — responses to address a chaotic circumstance of the government's own making," he wrote. "They belie measured and ordered governance, which is central to the concept of due process enshrined in our Constitution."

Sabraw, who was appointed to the district court by President George W. Bush, had said in earlier proceedings in the case that the government's policy "tears at the sacred bond between parent and child."

Lee Gelernt, deputy director of the ACLU's Immigrants' Rights Project, who argued the case, called Sabraw's ruling "an enormous victory for parents and children who thought they may never see each other again."

"Tears will be flowing in detention centers across the country when the families learn they will be reunited," he said in a statement.

A status conference was set for July 6.