U.S. Customs and Border Protection detained a 9-year-old U.S. citizen for more than 30 hours this week, then refused to explain why it took so long to verify her identity.

Thelma Galaxia and her children, 9-year-old Julia Isabel Amparo Medina and 14-year-old Oscar Amparo Medina, live in Tijuana, Mexico. Julia and Oscar are U.S. citizens, though, and they attend school in San Diego. One of Galaxia's friends drove Julia, Oscar, and her own children to the border so they could get to school on Monday, but decided it would be quicker for them to cross the border on foot due to traffic.

That's where Julia ran into trouble. While she has a passport card, the picture on it was taken when she was younger. Customs agents believed she was impersonating her cousin, Galaxia tells KNSD. The agents also accused Oscar of smuggling, the children say.

"My daughter told her brother that the officer told her that if she admitted that she was her cousin, she would be released soon so she could see her mom," Galaxia tells KNSD. "He was told that he would be taken to jail and they were going to charge him for human trafficking and sex trafficking."

Galaxia eventually got in touch with the Mexican consulate, and she was reunited with her children Tuesday evening. The entire ordeal took about 36 hours, KNSD reports.

The government does not deny that this happened. An agency spokesperson tells KNSD that Julia was detained because she "provided inconsistent information during her inspection."

"Some specifics of our techniques for determining the true identity of a person crossing the border are law enforcement sensitive information," the spokesperson adds. "In addition, some details of this case are restricted from release due to privacy concerns."

Any way you slice it, it shouldn't take that long for a government agency to confirm that a passport-carrying little girl is who she says she is.

This incident is not terribly surprising. This is an agency that used a secret database to journalists covering the migrant caravan that made its way toward the U.S. border last year. It's an agency with a history of harassing U.S. citizens around the border. It's an agency that boarded a bus in New Mexico and asked passengers one by one, "Are you a citizen?"

Unfortunately, such actions are considered legal. The Supreme Court has upheld immigration agents' extra authority in areas near the border. As far as the law is concerned, your Fourth Amendment rights essentially evaporate when you come close to a national frontier.

But even if the courts think this is legal, it isn't right. "I was scared," Julia Medina tells KNSD. "I was sad because I didn't have my mom or my brother. I was completely by myself."