U.S. Customs and Border Protection held more than 50 Brazilian migrant parents and their children for weeks in a tent-like facility near the Mexican border — far longer than the typical three-day detention period — to allow U.S. officials to deport them.

Brazil’s Ministry of Foreign Affairs said the families were in custody from 15 to 25 days in El Paso before they were deported to Belo Horizonte via a charter flight on Oct. 25. Brazilian officials declined further comment.

U.S. officials acknowledged that the families were among a group of nearly 70 Brazilian nationals expelled last month, including one criminal suspect who had been held separately. Federal authorities declined to say how long the migrants were detained in CBP custody or why they did not release the families to specialized holding facilities or to sponsors in the United States when their detention dragged on.

CBP’s rules say that migrants generally should not be detained in border facilities for more than 72 hours, and a federal judge has ruled that under a long-standing federal court agreement known as the Flores Settlement, migrant children cannot be held longer than 20 days in an unlicensed facility.

Physicians and Democratic lawmakers have expressed concerns about prolonged stays in border jails because the facilities can become breeding grounds for illnesses such as the flu. Democratic lawmakers, alarmed by the deaths of several detained migrant children, urged CBP to provide migrants with the flu vaccine this fall. Agency officials declined, noting that their jails are meant for short-term stays.

U.S. officials would not say how long each family was detained or how many children were among the group. A list compiled by advocates for immigrants showed that nearly 30 of the detainees were minors, including several infants and toddlers.

Carlos Holguin, a lawyer who represents migrant children in the Flores case, said the government cannot hold minors beyond court-mandated limits for “administrative convenience,” such as enabling the U.S. government to deport them. He said the court settlement states that the minors are supposed to be removed from border jails “without unnecessary delay.” Anyone held longer than the 20-day mark should have been given the option of releasing their child to an appropriate facility for minors, he said.

He called the prolonged detention “inhumane” and a “violation of common human decency.”

CBP said it “followed all laws and regulations pertaining to this incident” and “maintains family unity to the greatest extent possible.” CBP officials said the families were detained in a sturdy “soft-sided” facility with pressurized-rubber walls and access to showers, toilets, laundry equipment and hot meals, including baby formula and snacks at all times. There were no play areas or schools, and people slept on four-inch-thick mats in a large, open room.

Heloisa Galvao, executive director of the Brazilian Women’s Group in Massachusetts, said the detainees’ families told her they did not have access to lawyers or telephones, and some were not allowed daily showers. She said some of the young children, including 1-year-old twin sisters and a 2-year-old girl, became sick with cold-like symptoms during their detention.

“It’s awful,” said Galvao, who said many of the families were going to join relatives and friends in Massachusetts and Florida, seeking to escape political and financial turmoil in Brazil. “This is awful to keep the kids like that.”

Because immigration arrest and court records are not public, it is impossible to independently verify when each migrant arrived. Galvao said some arrived in late September, and others crossed the border in early October. She said the migrants were not entered into an online detainee locator, so their relatives and advocates could not find them.

U.S. officials said they have seen an uptick in migrants arriving from Brazil, including 17,000 in the El Paso region during the past fiscal year.

CBP officials said extended stays in border jails are rare. In a joint statement, CBP and Immigration and Customs Enforcement officials said they are continuing “to refine processes to determine which individuals, or families, DHS is able to house, remove, or release.”

“DHS is committed to reducing the amount of time aliens remain in DHS custody and to discourage individuals, especially family units, from making often dangerous journeys to the United States under the false pretense that they will be allowed to remain in the country,” CBP and ICE said in the statement.

Border officials normally send migrants who are seeking asylum to ICE, which detains and deports them or releases them into the United States with a notice to appear in immigration court. Families are more difficult to hold because of legal restrictions on how long the U.S. government can detain children. The Trump administration sought to detain children longer than 20 days after a historic influx of asylum-seeking families last fiscal year, but a federal judge blocked that effort in September.

Nearly 1 million migrants were taken into custody last fiscal year, including a record number of families, most of them from Central America. Border jails overflowed with parents and children, prompting CBP to take the unusual step of releasing migrants directly into the United States while they awaited their court dates.

Apprehensions have declined since the White House pressured Mexico to increase enforcement in June. In September, Kevin McAleenan, then acting secretary of the Department of Homeland Security, declared that CBP would no longer release migrants directly into the country except in medical or humanitarian emergencies.

Officials said most of the Brazilian nationals deported Oct. 25 were eligible for “expedited removal” without a hearing because they crossed the border illegally and did not claim asylum. All had final deportation orders and the travel documents needed to fly.

But their deportations took longer, in part because of logistical delays in organizing the flight to Brazil, U.S. officials said, though they did not provide details.

DHS has said it prefers to detain families in its more comprehensive family residential centers, which have cafeterias, bedrooms and classes for children. But immigration officials said ICE cannot accommodate all families because detainees generally are segregated by gender and age.