In seeking to dismiss the A.C.L.U. lawsuit, the administration argued that asylum-seeking families had no constitutional right to remain together. But the judge said that the allegations in the suit “sufficiently describe government conduct that arbitrarily tears at the sacred bond between parent and child, and is emblematic of the exercise of power without any reasonable justification in the service of an otherwise legitimate governmental objective.”

Lee Gelernt, deputy director of the A.C.L.U.’s Immigrants’ Rights Project, said the ruling was a significant step forward in challenging the policy. “We are enormously pleased with the ruling about an issue that has galvanized so many and outraged the country,” he said. “The judge left no doubt that he viewed the practice of separating young children from their parents as inhumane.”

A Justice Department spokesman declined to comment.

The plaintiffs argued in the lawsuit, filed before the administration unveiled its latest zero-tolerance policy, that it was a violation of due process to separate parents and children simply as a means to deter illegal immigration. Only parents who are abusive or unfit to care for their children can legally have them taken away, the suit argued.

“In the strongest possible language, the court rejected the Trump administration’s claim that these families have no constitutional right to remain together,” said Mr. Gelernt, who argued the case.

Hundreds of immigrant children had already been separated from their parents at the border even before the latest policy went into effect. In the first two weeks after its unveiling, 638 parents who arrived with 658 children were prosecuted, according to administration officials.

The government plans to fast-track prosecution of those criminally charged with illegal entry in California, with group hearings near the border, according to Reuben Cahn, executive director of Federal Defenders of San Diego. Such expedited proceedings already have been occurring in Arizona and Texas, where dozens of immigrants are prosecuted each day.

Judy London, directing attorney at Public Counsel, a pro bono law firm in Los Angeles that represents asylum seekers, said the court’s decision, though largely procedural, represented a strong condemnation of the government.