LAS CRUCES, N.M. — A 7-year-old girl who crossed the U.S.-Mexico border with her father last week died after being taken into custody by the U.S. Border Patrol, federal immigration authorities confirmed Thursday.

The Washington Post first reported that the girl died of dehydration and shock more than eight hours after she was arrested by agents near Lordsburg, New Mexico. The girl was from Guatemala and was traveling with a group of 163 people who approached agents to turn themselves in on Dec. 6.

It was unknown what happened to the girl during the eight hours before she started having seizures and was flown to a hospital in El Paso, Texas.

A girl cries as a group of migrants decide whether or not to attempt to climb the border fence into the U.S. from Tijuana, Mexico on December 12, 2018. Leah Millis / Reuters

Customs and Border Protection said in a statement to the Post that the girl had not eaten or consumed water in several days.

The U.S. Department of Homeland Security said in a statement Thursday night that the girl had a fever of 105.7 degrees and was flown by helicopter to the hospital, where she went into cardiac arrest.

She was revived but did not recover and died 24 hours after her arrival, officials said in the statement.

"Despite our best efforts and the best efforts of the medical team treating the child, we were unable to stop this tragedy from occurring," DHS said. "Once again, we are begging parents to not put themselves or their children at risk attempting to enter illegally."

Homeland security officials said Customs and Border Protection has launched an investigation.

"This is tragic," U.S. Sen. Kamala Harris, D-California, tweeted. "We need a full and thorough account of what happened before this 7-year-old girl died of dehydration and exhaustion in CBP custody."

Processing 163 immigrants in one night could have posed challenges for the agency, whose detention facilities are meant to be temporary and don't usually fit that many people.

When a Border Patrol agent arrests someone, that person gets processed at a facility but usually spends no more than 72 hours in custody before they are either transferred to Immigration and Customs Enforcement or, if they're Mexican, quickly deported home.

The girl's death raises questions about whether border agents knew she was ill and whether she was fed anything or given anything to drink during the eight-plus hours she was in custody.

Immigrants, attorneys and activists have long raised issues with the conditions of Border Patrol holding cells. In Tucson, an ongoing lawsuit claims holding cells are filthy, extremely cold and lacking basic necessities, such as blankets. A judge overseeing that lawsuit has ordered the agency's Tucson Sector, which patrols much of the Arizona-Mexico border, to provide blankets and mats to sleep on and to continually turn over surveillance footage from inside the cells.

The Border Patrol has seen an increasing trend of large groups of immigrants, many with young children, walking up to agents and turning themselves in. Most are Central American and say they are fleeing violence. They turn themselves in instead of trying to circumvent authorities, many with plans to apply for asylum.

Agents in Arizona see groups of over 100 people on a regular basis, sometimes including infants and toddlers.

Arresting such groups poses logistical problems for agents who have to wait on transport vans that are equipped with baby seats to take them to processing facilities, some which are at least a half-hour north of the border.

The death of the 7-year-old comes after a toddler died in May just after being released from an ICE family detention facility in Texas, and as the Trump administration attempts to ban people from asking for asylum if they crossed the border illegally. A federal appeals court has temporarily blocked that ban, but the administration asked the U.S. Supreme Court to reinstate it Tuesday.

Cynthia Pompa, advocacy manager for the ACLU Border Rights Center, said migrant deaths increased last year even as the number of border crossing dropped.

"This tragedy represents the worst possible outcome when people, including children, are held in inhumane conditions," she said. "Lack of accountability, and a culture of cruelty within CBP have exacerbated policies that lead to migrant deaths."