An Afghan national with ties to the Taliban — and a plot to carry out a terror attack somewhere in North America — was caught last fall after being smuggled into the U.S. from Mexico, an incident sure to further inflame the debate over national security risks at the border.

The Afghan national’s alleged terror ties were not initially flagged in a terror database – and as a result, not initially reported – when the incident first came to light last November, according to Rep. Duncan Hunter, R-Calif., who obtained Homeland Security documents on the incident. It was only later that U.S. officials discovered his associations.

Hunter told Fox News on Friday that the database disconnect represents a “monumental failure.” 

“We don’t know who’s coming into the U.S. and what they’re bringing with them,” he told Fox News’ “America’s Newsroom.” “It is as bad as it seems.”

The new details were first reported by The Washington Times.

According to information shared with FoxNews.com by Hunter’s office, the Afghan in question was picked up and detained by U.S. Border Patrol agents about 15 miles inside Arizona from the border. He was arrested along with five Pakistani citizens and two Mexicans identified as smugglers.

The Afghan claimed he crossed into the U.S. on Nov. 13, 2015 by crawling under a border fence near Nogales, Ariz. But an initial check in one of the terror databases apparently did not flag him.

As a result, all six illegal immigrants – from what are known as “special interest” countries – were cleared by the National Targeting Center.

According to a letter sent Wednesday from Hunter to Homeland Security Secretary Jeh Johnson, all six were initially served with an “Expedited Removal.” The Afghan national “sought U.S. immigration benefits, and was processed as having credible fear after he stated his life was in danger,” Hunter wrote.

However, according to the letter, the individual was in fact identified in a separate database, the Terrorist Identities Datamart Environment (TIDE), as having terror ties.

Hunter wrote that the individual was said to be “involved in a plot to conduct an attack in the U.S. and/or Canada and has family ties to members of the Taliban.”

For an unknown reason, the individual was not initially watch-listed in the separate Terrorist Screening Database, according to the letter – and so these associations were not initially noticed.    

Officials apparently noticed the error in time, as the individual remains in U.S. custody in Arizona.

But Hunter said in his letter to Johnson that his understanding is the whereabouts of the other men arrested that day “is unknown.” Hunter asked DHS for additional details.

Hunter also pushed back Friday on the notion that the incident could represent a success since the Afghan national was ultimately apprehended and later flagged.

“You can assume that others have gotten through,” Hunter told Fox News.

The information shared with FoxNews.com showed at least a dozen illegal immigrants from Afghanistan and Pakistan have either made it across the U.S. border or gotten close, dating back to 2014.

The Washington Times reported that the incident last fall involved a Brazilian-based smuggling network.

The Afghan national in question apparently took a complicated route, essentially around the world and then through Latin America, to arrive in Arizona. He told officials he left Afghanistan in 2015 and then traveled from Dubai to Brazil. From there, he moved up through Peru and other South American countries before traveling through Central America.

In August 2015, he was apprehended in Panama but was released when “no derogatory information” on him was found. He continued his journey, crossing into the U.S. in November before being detected, along with his group, by Border Patrol.

The apprehensions were reported at the time.

However, the local reports, based on comments from border officials, also said no “derogatory information” turned up when their names were run through security databases.

“The American people would have had no clue on this if we didn’t get these documents from Homeland Security,” Hunter said Friday. 

Reached for comment, a DHS spokesperson said:‎ "Department of Homeland Security agencies and our partners are consistently targeting, through a sustained and unified effort, human smuggling networks. However, as a matter of policy, we do not confirm details in ongoing criminal investigations or law enforcement operations.‎" 

FoxNews.com's Jennifer Hickey contributed to this report.