A seven-year-old girl who crossed a remote part of the US-Mexico border with her father last week died less than two days after being apprehended by the US border patrol in New Mexico, immigration officials have said.

The girl vomited and stopped breathing in the custody of US Customs and Border Protection (CBP) before being transferred to a hospital, where she suffered brain swelling and cardiac arrest, according to CBP.

The CBP commissioner, Kevin McAleenan, identified the girl as Jakelin Caal Maquin. “We welcome the Department of Homeland Security’s investigation and will review the incident operationally to learn from this tragedy,” McAleenan said.

The girl and her father, both from Guatemala, were traveling in a group of 163 people, including 50 children who were traveling without a parent, when they were apprehended at around 9.15pm on 6 December.

Four border patrol agents were on the scene, according to CBP and Department of Homeland Security (DHS) officials, who said it was not unusual for a small group of agents to confront large groups of migrants.

The agents conducted a screening that included a health observation. Her father indicated his daughter was healthy on a form officials said was in English but would have been marked according to a Spanish interview with the father.

They were held in a small facility near the border before being transferred by bus to a border patrol station 95 miles away. At that facility, officials said people had access to food, water and restrooms.

On the bus, just before 5am, the father told agents his child was sick and vomiting, then personnel at their destination were notified about the medical situation, officials said. Once they arrived, about an hour later, the father told agents his child was not breathing. Emergency medical technicians revived her twice before she was taken by air ambulance to a children’s hospital in El Paso, Texas.

Officials said later that morning Jakelin went into cardiac arrest, showed signs of brain swelling in a scan, was breathing by machine and had liver failure.

She died at 12:35am on Saturday with her father on the scene, officials said.

“On behalf of the Department of Homeland Security, our sincerest condolences go out to the family of the child,” a CBP spokesperson said. “Border patrol agents took every possible step to save the child’s life under the most trying of circumstances. As fathers and mothers, brothers and sisters, we empathize with the loss of any child.”

The CBP said it will investigate the incident and that an autopsy of the girl is expected.

The girl was suffering from dehydration and shock, according to CBP records seen by the Washington Post. The agency told the Post the girl “reportedly had not eaten or consumed water for several days”. The CBP did not confirm those details to the Guardian.

In response to the death, the White House, CBP and DHS repeatedly emphasized that the journey to the northern border is “extremely dangerous” because of the threat of violence, trafficking, extreme weather and wild animals. They said people should arrive at designated ports of entry instead of at other places on the 2,000-mile border.

But migrant rights groups say the Trump administration is exacerbating those dangers by limiting how many people can present for asylum at designated ports of entry.

Journalists and humanitarian groups have documented the US government limiting how many people can present themselves for asylum each day at ports of entry in a practice known as “metering”.

And in October, the DHS’s watchdog, the office of inspector general, said there were documented incidents of people being turned away at ports of entry and told to return when it was less busy. The report said there was evidence “limiting the volume of asylum seekers entering at ports of entry leads some aliens who would otherwise seek legal entry into the United States to cross the border illegally.”

The Trump administration also tried to bar people from seeking asylum outside ports of entry, but a federal appeals court temporarily blocked the ban because he said the government could not prove it was legal. On Tuesday, the Trump administration asked the supreme court to reinstate the ban.

The White House deputy press secretary, Hogan Gidley, said the girl’s death was tragic. She said: “If we could just come together and pass some commonsense laws to disincentivize people from coming up from the border and encourage them to do it the right way, the legal way, then those types of deaths, those types of assaults, those types of rapes, the child smuggling, the human trafficking … that would all come to an end.”

Cynthia Pompa, the advocacy manager for the ACLU border rights centre, said the number of migrant deaths had increased last year even as the number of border crossings fell.

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