In this June 2018 photo provided by U.S. Customs and Border Protection, people who have been taken into custody related to cases of illegal entry into the United States, sit in one of the cages at a facility in McAllen, Tex. (U.S. Customs and Border Protection's Rio Grande Valley Sector/AP)

An 18-year-old U.S. citizen who was detained in federal immigration custody for nearly a month has been released, his mother confirmed to The Washington Post Tuesday night.

Francisco Erwin Galicia, a rising high school senior in Edinburg, Tex., had set off on a Texas road trip on June 27 to attend a college soccer team tryout only to end up accused of lying about his citizenship as authorities questioned the authenticity of his documents, according to his attorney, Claudia Galan.

He had been traveling to North Texas with his brother and a group of friends for the scouting event when they were stopped at a Border Patrol checkpoint in the South Texas town of Falfurrias, about 65 miles north of their hometown, Galan said.

They were asked for papers. And Galicia had plenty, including a wallet-sized Texas birth certificate, a Texas ID card and Social Security card, Galan said.

But U.S. Customs and Border Protection detained Galicia anyway over suspicion that his documents were fraudulent, she said, making him one of hundreds of American citizens in recent years who, mistakenly targeted by federal immigration authorities, have been forced to prove their citizenship while the threat of deportation hangs over their head.

“He’s been here all his life,” Galan said, but “when Border Patrol checked his documents, they just didn’t believe they were real. They kept telling him they were fake.”

CBP and ICE said in a joint statement Wednesday that Galicia provided “conflicting reports regarding status of citizenship after being apprehended by U.S. Border Patrol and transferred into Immigration and Customs Enforcement Custody.”

“Situations including conflicting reports from the individual and multiple birth certificates can, and should, take more time to verify,” the statement said. "While we continue to research the facts of the situation, the individual has been released from ICE custody. Both CBP and ICE are committed to the fair treatment of migrants in our custody and continue to take appropriate steps to verify all facts of this situation.”

The story was first reported by the Dallas Morning News.

CBP was initially suspicious of Galicia because others in the car did not have proper identification. His 17-year-old brother, who was born in Mexico and has no legal status, only had a school ID. Galicia, born in Dallas in 2000, was taken to a CBP facility where he languished for weeks while authorities sought to confirm his Texas paperwork. He was transferred to an ICE detention facility over the weekend, stuck in the throes of removal proceedings, Galan said. His brother, Marlon, was deported voluntarily within two days.

The reason it appears to have taken CBP and ICE so long to determine Galicia’s citizenship is because his mother, who is not a citizen, took out a U.S. tourist visa in his name while he was still a minor, falsely saying he was born in Mexico, Galan said. His mother, Sanjuana, told The Washington Post that CBP discovered the visa after fingerprinting her son. The conflicting documents only fueled the agency’s suspicion that Galicia’s U.S. documents were fake, Galan said.

Sanjuana said she took out the tourist visa for her son because she saw it as the only way he could travel back and forth across the border to visit family. The undocumented mother was unable to get him a U.S. passport because when Galicia was born, Galan said, she gave a different name for herself on his birth certificate. (The birth certificate and other identifying documents were reviewed by The Post.)

But Galan said that even after explaining his mother’s error to CBP authorities, and after faxing additional paperwork corroborating that he is a U.S. citizen, Galicia remained in detention. She said she started the process again with ICE and traveled to the agency’s South Texas Detention Facility on Tuesday to assist Galicia in signing the paperwork that she hoped would secure his release.

On Tuesday, he finally was able to go home.

Before then, Sanjuana said she was unable to even speak to her son on the phone until July 20, and said her son was “desperate” to leave detention, fearing that he could be deported to Mexico at any time.

“All of the abuse he has gone through pains me,” she told The Post in Spanish on Monday night. “I can’t sleep thinking that they are going to harm him because they think he is lying about his citizenship.”

The report from the Morning News on Monday night grabbed the attention of some elected officials, including Rep. Alexandria Ocasio-Cortez (D-N.Y.).

“CBP is detaining *American citizens,*” she wrote on Twitter. “How would you feel trapped in a border camp, where guards wear face masks because the human odor is so strong? When we allow the rights of some to be violated, the rights of all are not far behind.”

Although U.S. citizens make up only a small fraction of the total number of arrests made by ICE, it’s not necessarily a rare event, according to recent reports. In an April 2018 investigation, the Los Angeles Times found that ICE had released more than 1,480 people from its custody since 2012 after investigating their citizenship claims. In Texas alone, the Cato Institute estimated that ICE had wrongfully placed detainers — requests to local jails to hold a person in custody so ICE can pick them up — on hundreds of U.S. citizens between 2006 and 2017.

Drea Cornejo contributed to this report.

More from Morning Mix:

A supermarket worker vanished 10 years ago. He was trapped behind a cooler the whole time.

Pence abruptly canceled a New Hampshire trip to avoid a drug dealer

Young people are throwing buckets of water at New York cops. Leaders blame politicians’ ‘anti-police rhetoric.’