American teen who was detained near border plans to sue government after being released Francisco Erwin Galicia, 18, was detained for more than three weeks.

An American teenager has been released from immigration custody in Texas after being detained for almost a month, according to federal officials.

Francisco Erwin Galicia, an 18-year-old U.S. citizen who was born in Dallas and lives with his family in the Texas border city of Edinburg said he was driving with his brother and some friends on June 27 when they were stopped at a U.S. Border Patrol inland checkpoint in Falfurrias. Galicia said the federal agents separated him from his brother, who was born in Mexico but was living undocumented in the United States, according to ABC Dallas affiliate WFAA.

Galicia said he had his Texas state driver's license, U.S. Social Security card and a copy of his birth certificate in his wallet at the time, but he was detained by Border Patrol for three weeks then transferred to the U.S. Immigration and Customs Enforcement detention center in Pearsall, Texas.

"They thought they were fake," Galicia told ABC Dallas affiliate WFAA in an interview Tuesday. "I had all my papers, but they still didn't believe me. I don't know the reason why."

Galicia said he lost at least 20 pounds while living in terrible conditions in detention.

"There were up to 70 people in a room," he told WFAA. "They wouldn't let us brush our teeth or go to the bathroom. There were people who were very sick inside, and it's really inhumane the way we were treated."

Galicia told the affiliate that his mother eventually called Texas-based immigration attorney Claudia Galan for help. Galan said she took Galicia's birth certificate and other documents to the facility where he was being housed two weeks ago but didn't have any luck until she contacted members of the press. Galicia's story soon captured national news headlines.

Galicia was released from ICE custody on Tuesday, officials said.

"Francisco's English is not good. So they probably thought, if he was a U.S. citizen he should be able to speak English," his lawyer told WFAA. "They also probably thought that because he's with other undocumented immigrants that he was one too."

A joint statement from ICE and U.S. Customs and Border Protection appeared to accuse Galicia of providing agents with "conflicting reports" and "multiple birth certificates" while in custody.

"Generally, situations including conflicting reports from the individual and multiple birth certificates can, and should, take more time to verify," the federal agencies said in the joint statement, obtained by ABC News on Thursday. "While we continue to research the facts of the situation, this 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."

Neither agency would comment on the status of Galicia's 17-year-old brother, Marlon, who told The Dallas Morning News that he agreed to be returned to Mexico.

Galicia's attorney said she believes her client was profiled and that she plans to file a lawsuit on his behalf against both agencies in the coming weeks.

"Their job is to deport people. Their practice is to be tough," Galan told WFAA. "But they should have looked into his claim from day one. They had the documents."