Updated

The head of Immigration and Customs Enforcement defended the role of federal agents in transporting illegal immigrant children after a federal judge complained they were hand-delivering smuggled kids to parents in the United States.

“While the court’s comments did not relate specifically to ICE, it is clear that the transportation of unaccompanied children (UAC) by ICE personnel is appropriate and legal,” acting Director John Sandweg wrote in a brief email obtained by FoxNews.com.

The email was sent Monday and addressed to “all ICE employees.”

Sandweg noted that “recent media reports” on the judge’s order had “prompted discussion about whether ICE personnel may lawfully transport alien minors.”

He was referring to a Dec. 13 order by U.S. District Judge Andrew Hanen in Texas, which claimed federal agents were intercepting human smugglers transporting children at the U.S.-Mexico border -- and then delivering those children to illegal immigrant parents in the U.S.

More On This...

The situation is likely more complicated and involves more agencies than the order made it sound. While Hanen focused on the Department of Homeland Security, officials say minors are typically handed over to the Office of Refugee Resettlement, within the Department of Health and Human Services.

Indeed, Sandweg’s email referred to what ICE agents can or cannot do at the direction of the health agency.

“Although ICE’s role in managing the UAC population is very limited, [Enforcement and Removal Operations] personnel are lawfully permitted to transport UACs to a location designated by ORR,” he said.

It is a matter of public record that thousands of illegal immigrant children and teens are caught trying to enter the United States, and often sent to federally-run care centers while their status is determined.

Hanen’s order, though, claimed the Obama administration was engaging in a risky practice by delivering some children to their parents. He argued that the practice would only encourage more parents to have their children smuggled over the border, through operations often connected to the drug cartels.

"These actions are both dangerous and unconscionable," he wrote.

Critics say these policies and others are creating a magnet for illegal immigration. Statistics released late last week showed the number of children crossing the U.S.-Mexico border has in fact surged over the last two years.

The stats show 24,668 "unaccompanied alien children" were placed last year in the care of the Office of Refugee Resettlement. That's nearly double the number from 2012, and nearly quadruple the number in years past. Most were from Central America.