She arrived next at a family detention center in Dilley, Tex., with a kidney infection that had been exacerbated by the lack of drinkable water at the processing center, according to the filing. She said she was given only acetaminophen by a male nurse who, when she asked to see a doctor, told her to go to the mental health office “because I was imagining my pain.”

A 16-year-old girl named Keylin said the female guards at the border processing facility in McAllen, Tex., kicked her and other migrants with their boots to keep them awake. “The female guards made me and the other girls strip naked in front of them and leered at us before their showers,” she said in her declaration.

Spokespeople for the Department of Homeland Security did not respond to requests for comment on the physicians’ whistle-blower letter. But in a response to the Los Angeles court filing, Justice Department spokesman Devin M. O’Malley cited a recent report to the judge from Henry A. Moak Jr., chief accountability officer for U.S. Customs and Border Protection, who interviewed 38 children and a number of parents during eight unannounced visits to detention facilities. Mr. Moak concluded in his report that the government remained in compliance with a 1997 consent decree, known as the Flores agreement, providing for the humane treatment of migrant children.

The letter from Dr. Allen, former chair of the department of internal medicine at the University of California at Riverside, and Dr. McPherson, a child and adolescent psychiatrist at the Shreveport Behavioral Health Center in Louisiana, urges Congress to block the Trump administration’s proposal to possibly expand the population housed in these centers to 15,000 — a fivefold increase in the current population.

The Immigration and Customs Enforcement agency currently operates three such detention centers, two in Texas and one in Pennsylvania, with a combined capacity of 3,326. Under the terms of the 1997 consent decree, children at such centers cannot be confined for long periods, usually interpreted as 20 days.

Yet one woman from El Salvador, interviewed as part of the Los Angeles court case, reported that she and her 10-year-old son had been held at the family detention center in Dilley for 58 days. Another woman said she and her 6-year-old daughter had been at Dilley for 45 days. Government officials say families could be detained for longer periods if a parent elects to remain in custody with a child, rather than having the child released to a relative.

While conditions at the border processing centers appeared to be the worst, as reported in the court filings, numerous problems were documented at the family detention centers, as well. Dr. Allen and Dr. McPherson were aided with their letter describing shortcomings at those facilities by the Government Accountability Project, a nonprofit that works with government whistle-blowers.