The American Civil Liberties Union argued that the administration was splitting families over dubious allegations and minor transgressions including traffic offenses.
It asked the judge in July to rule on whether the government was justified in separating 911 children during the first year after the judge halted the general practice in June 2018.
U.S. District Judge Dana Sabraw indicated he was uncomfortable second-guessing government decisions to separate children on grounds that parents were considered unfit or dangerous, or in other limited circumstances like criminal history, communicable diseases and doubts about parentage. He found no evidence that the government was abusing its discretion.
"It is an invitation that is potentially massive in scope, invades an area that is particularly within the province of the executive branch to secure the nation's border, and goes beyond this court's class certification and preliminary injunction orders, which were focused on the administration's practice of separating families at the border for the purpose of deterring immigration, and failing to reunify those families," Sabraw wrote in a 26-page decision.
In a partial victory for the ACLU, the judge said the government must settle any doubts about parentage before separating families by using DNA tests that deliver results in about 90 minutes.
The ruling was a rare instance of the San Diego judge siding with the administration. In June 2018, he halted the practice of separating families under a "zero tolerance" policy to deter illegal immigration and ordered that about 2,800 children be quickly reunited with family. Lack of adequate tracking systems at the time made reunification a monumental task.
The judge later ordered the administration to identify more than 1,500 additional children who were separated earlier in Trump's presidency, starting in July 2017. The government is providing information to the ACLU, which, in some cases, has volunteers going door to door in Guatemala.
The ACLU said it was considering its next move.
"The court strongly reaffirmed that the Trump administration bears the burden if it attempts to separate families based on an accusation that the adult is not the child's parent," said ACLU attorney Lee Gelernt. "We are evaluating the decision to determine next steps on how to ensure that children are not separated from their parents based on minor infractions."
The Justice Department didn't immediately respond to a request for comment.
The judge noted that the administration acknowledged it erred by separating a mother who needed emergency surgery and a father who was HIV-positive. He rejected the ACLU's contention that some accusations of gang affiliation were unfounded, saying that the government relies on "objective evidence, not allegations or intuition."
Days before the judge halted the widespread practice of separating families in 2018, Trump retreated under extraordinary criticism by exempting families from his "zero tolerance" policy to criminally prosecute every adult who crosses the border illegally.