A Texas-born U.S. citizen was released Tuesday from Immigration and Customs Enforcement custody after being wrongfully detained for more than three weeks due to a mix-up of his documents, his lawyer said.

Francisco Erwin Galicia, 18, of Edinburg, Texas, was released from ICE’s Pearsall facility on Tuesday. Claudia Galan, his lawyer,  posted a photo him exiting the facility on her Facebook account.

TRUMP ADMINISTRATION AIMS TO EXPAND FAST-TRACK DEPORTATIONS ACROSS US, LEGAL FIGHT EXPECTED

Galan said that the Department of Homeland Security, which oversees both Border Patrol and ICE, needs to be held accountable for what she called racial profiling.

Galicia was travelling with a group of friends, all Latinos, when they were stopped at a Border Patrol inland checkpoint on a highway north of Edinburg. The teen presented a wallet-sized Texas birth certificate, a Texas ID card and a Social Security to agents but was taken into custody on suspicion that he was in the U.S. illegally and his documents were fraudulent, the Washington Post reported.

He was detained for three weeks by Border Patrol before he was transferred to the detention facility on Saturday.  Galicia was born in Dallas on Dec. 24, 2000, Dallas Morning News reported. The paper was the first to report his detention, sparking outcry from activists online.

The teen’s mother, Sanjuana Galicia, is an undocumented immigrant. Galan said that agents may have suspected the teen's documents were fraudulent based on previous documents his mother took out in his name. When the teen was still a minor, his mother took out a U.S. tourist visa in his name, falsely saying on the document that her son was born in Mexico, thinking it would make it easier for him to travel there to visit family, she said.

CLICK HERE TO GET THE FOX NEWS APP 

His mother also said that when her son was born, she gave him a different name, the Washington Post reported. She was never able to get her son a U.S. passport because the name on his birth certificate did not match other documents, she said.

Immigration authorities are not supposed to detain U.S. citizens. But both ICE and CBP have apprehended citizens in the past.

The Associated Press contributed to this report.