A U.S. judge ruled Monday that the Trump administration is operating within its authority when separating families stopped at the Mexico border, rejecting arguments that it was quietly returning to widespread practices that drew international condemnation.

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 with DNA tests that deliver results in about 90 minutes. The administration resisted the requirement, citing “operational concerns."

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, while welcoming the requirement for rapid DNA tests.

“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.