Jose Antonio Vargas, the former journalist who has spent the past few years crusading on behalf of fellow undocumented immigrants, was detained by U.S. Customs and Border Protection agents Tuesday and held for much of the day after trying to leave a Texas border town without a valid U.S. visa.

Vargas was taken into custody Tuesday morning at McAllen-Miller International Airport and was held for about eight hours until his early-evening release. He received a notice to appear before an immigration judge.

“As an unaccompanied child migrant myself, I came to McAllen, Texas, to shed a light on children who parts of America and many in the news media are actively turning their backs on,” Vargas said in a statement following his release. He added: “I want to thank everyone who stands by me and the undocumented immigrants of south Texas and across the country. Our daily lives are filled with fear in simple acts such as getting on an airplane to go home to our family.”

The high-profile and widely documented detainment came after the former Washington Post reporter made a series of public pronouncements that he might be trapped on the border. Vargas, 33, is a Filipino immigrant who has lived in the United States, without proper documents, since he was 12.

Department of Homeland Security spokeswoman Marsha Catron said in a statement that federal agents who encountered Vargas at the airport “apprehended him after he stated that he was in the country illegally.” Vargas, Catron said, was taken to the McAllen Border Patrol Station, “where he was processed and provided with a Notice to Appear before an immigration judge. He was released on his own recognizance after consultation with Immigration and Customs Enforcement (ICE).”

According to DHS officials, a foreign passport is an acceptable primary form of ID for travel. TSA agents verify that the name on the ID “substantially matches the name on the travel document.” Agents, officials said, do not check immigration status.

Vargas, perhaps the best-known undocumented immigrant in America, had gone to South Texas amid a border crisis that prompted the White House to request $3.7 billion in emergency funding.

Asked about the incident at a midday briefing, while Vargas was still being held in Texas, White House press secretary Josh Earnest said he had “no reaction to his detention.”

Vargas, founder of the nonprofit U.S. immigration-reform campaign Define American, tweeted Tuesday morning that he was about to go through security at the airport with nothing more than a Philippine passport and a pocketbook U.S. Constitution. “I don’t know what’s going to happen,” he wrote.

In a recording published by Huffington Post, where Vargas worked after leaving The Washington Post, an agent is heard asking Vargas: “Do you have your visa?”

“No,” Vargas tells him, “there’s no visa.”

Vargas, who came to the United States as an unaccompanied minor from the Philippines, revealed his undocumented status in a 2011 essay published by the New York Times. That same year, he made headlines again when he was kicked out of a Mitt Romney campaign event in Iowa, where he’d been holding up a sign that said: “I AM AN AMERICAN W/O PAPERS.”

In 2012, he appeared on the the cover of Time magazine and was arrested by Minnesota State Police for driving without a valid license. According to the New York Times, federal immigration officials decided not to detain him at the time, “because he did not present a risk to public safety.”

In the DHS statement Tuesday, Catron, the spokeswoman, said: “Mr. Vargas has not previously been arrested by ICE nor has the agency ever issued a detainer on him or encountered him. ICE is focused on smart, effective immigration enforcement that prioritizes the agency’s resources to promote border security and to identify and remove criminal individuals who pose a threat to public safety and national security.”

Last year, Vargas testified at a Senate hearing on immigration reform. He also wrote and directed “Documented,” a film about his status as an immigrant without papers. In the documentary, Vargas says he dreams of getting a green card and flying back to the Philippines to see his mother for the first time since he was a child. Define American representatives said he was flying to Los Angeles for a screening at the time of his detention.

Last week, shortly after “Documented” was shown on CNN, Vargas wrote in a Politico magazine piece that he’d gone to the U.S.-Mexico border “to visit a shelter for unaccompanied Central American refugees and participate in a vigil in their honor.” He wrote: “I realize that, for an undocumented immigrant like me, getting out of a border town in Texas — by plane or by land — won’t be easy. It might, in fact, be impossible.”

In a text message sent over the weekend to Post reporter Ernesto Londoño, Vargas wrote: “I feel stupid. I’ve been traveling around the country, visiting 43 states in like 3 years, and I’ve been flying using my Philippine passport. But I’ve never been to the Texas border area. I just figured I could use the passport. But apparently I can’t because border patrol agents check foreign passports.”

In an interview published Sunday by the Dallas Morning News, Vargas discussed the possibility of being detained in Texas:

Q: And now you have a real fear of not being able to get out of the area. Can you explain why that is and how it feels?
A: I’m the most privileged undocumented immigrant in the country. And with that privilege comes responsibility. The responsibility of tying my specific story to the story of 11 million undocumented people like me and using every skill and resources I have to tell stories and insist that we talk about this issue humanely and fairly.
The feeling of being stuck and trapped by our broken immigration system is very familiar to undocumented people like me. But it’s even more pronounced for undocumented immigrants who live in the border. And now I’m trapped like they are: There are check-points and border patrol agents everywhere, including at the airport. I’ve always felt trapped as an undocumented person who’s lived here for almost 21 years. And you make the most of what you can do. You try to stay positive.
Q: On the other hand, there’s always the chance that you won’t be detained…
A: I have no control over what the government chooses to do. But like the other 11 million undocumented immigrants whose lives are in limbo, I am not a threat to this country. Should people continue to be needlessly detained and deported while our government can’t come up with a compromise and provide a solution?

Vargas was a Washington Post reporter from 2004 to 2009 and was part of a team of Post journalists that won a Pulitzer Prize for coverage of the Virginia Tech shootings.

As The Post previously reported, Vargas, a native of the Philippines, “never established legal status, even after he discovered his uncertain standing when he applied for a driver’s license as a teenager in California. He kept the secret while employed with a series of news organizations” — although he did reveal his secret to one senior editor at The Post, Peter Perl. Perl, who has retired from the newspaper, did not share the information with his superiors.

Juliet Eilperin, Katie Zezima and Josh Hicks contributed to this report.

This post has been updated multiple times.

A previous version of this post incorrectly said that Define American was established to push for passage of the DREAM Act.