PHOENIX (AP) — The arrests of six Middle Eastern men caught entering the United States illegally from Mexico two years ago set off alarm in border states and in some right-wing blogs and other media outlets.

Arizona Gov. Doug Ducey called it a matter of national security and invoked the Islamic State group in a statement calling for stepped-up border security in response to the arrests. Conservative publications like the Washington Examiner reported on the men from "Middle East terror hotbeds," while Fox News questioned whether "Islamic State militants could be probing security."

Now, documents obtained by The Associated Press through a public records request reveal the men were fleeing violence and persecution in their homelands and were cleared of any terrorism ties. They also were physically and verbally abused by two Mexican smugglers with a history of crossing the border illegally and went days without food and water, the records show.

The case highlights the highly politicized nature of the U.S.-Mexico border as hysteria sometimes overtakes facts in an era where President Donald Trump, during his campaign, labeled Mexican immigrants rapists and criminals. Some blogs incorrectly reported the men were released. Others tied them to the Islamic State.

In fact, the men cooperated with the government, and four have been deported. The remaining two are in removal proceedings, according to Immigration and Customs Enforcement spokeswoman Yasmeen Pitts O'Keefe.

The five men from Pakistan and one from Afghanistan were arrested at a time when the Islamic State group was committing some of its bloodiest acts, just days after coordinated bombings and shootings in Paris heightened fears about attacks in the U.S.

The arrests also came around the same time as two Syrian families with children presented themselves at the border seeking asylum. The families were Christian and fleeing persecution. Still, the incident prompted a tweet from Trump that said, "Eight Syrians were just caught on the southern border trying to get into the U.S. ISIS maybe? I told you so. WE NEED A BIG & BEAUTIFUL WALL!"

But none of the cases had any ties to terrorism.

Government officials have long denied there have been any arrests of migrants at the U.S.-Mexico border with ties to the Islamic State, and private security analysts agree.

Scott Stewart, vice president of tactical analysis for Texas-based intelligence firm Stratfor, said he knows of no instances of terrorists sneaking into the U.S. through the southern border.

He says it's much more likely a terrorist would use the Canadian border to sneak into the country, as Ahmed Ressam did in 1999. Ressam planned to bomb the Los Angeles airport and used false documents to enter the U.S. from Canada. Border authorities caught him with a car full of explosives.

Stewart added it's highly unlikely the Mexican cartels, which control smuggling corridors, would help a terrorist enter the United States.

"The last thing they want is to be labeled as narco-terrorists. That's just terrible for business," Stewart said. "I'm honestly much more concerned about meth, fentanyl and heroin than I am of Al-Qaeda or the Islamic State coming across."

Despite most border crossers being from Latin America, a small number come from far-away places like China, India, Pakistan and Afghanistan.

Investigative files obtained by the AP show the Middle Eastern men completed a long and costly journey to America.

The Afghan man told Border Patrol agents he left his home seven months earlier and traveled through at least 10 countries before making it to the U.S. He was detained for weeks in Honduras, Costa Rica, Panama and Mexico and paid nearly $15,000 in smuggling fees along the way.

Once the men reached the U.S. border, the smugglers told them crossing illegally into Arizona would be a matter of a few easy hours.

But their trip took several days in treacherous conditions.

The men spent three or four days walking through the desert. They ran out of water on the first night and food on the second, and then trekked through mountains near the border in snow and rain. The men said they had no jackets.

They said the smugglers verbally accosted them and threw rocks at them if they walked too slowly. The Afghan man said one of the smugglers punched him in the chest. When one man injured his ankle, a smuggler said "Bye-bye" and kept walking. Another man who couldn't keep up said he paid the smugglers more to slow down.

The men were arrested in November 2015 after triggering a Border Patrol sensor about 15 miles (24 kilometers) north of the border.

The arrests were first reported by right-wing blogs, then other news organizations. Three days after the Middle Eastern men were taken into custody, Ducey issued a statement saying their arrests were troubling, "especially in light of new threats on the United States from ISIS in a video released in just the last 24 hours."

But the FBI had already cleared the men, finding they had no ties to terrorism, according to the documents.

When asked about the governor's tweet, Ducey's spokesman issued a statement that touted the Republican's border efforts but did not address the issue of invoking the Islamic State when the men had no terrorism ties.

"The governor continues to put public safety at the forefront," spokesman Daniel Scarpinato said.

The men were interviewed separately, and all told authorities about abuses at the hands of the two Mexican smugglers. They became witnesses in the case against Ernesto Dorame-Gonzalez and Martin Lopez-Alvarado, who had committed prior immigration offenses and pleaded guilty to smuggling charges.

"We find smugglers are more interested in treating people as a commodity instead of human beings," said Stephanie Dixon, a spokeswoman with the Border Patrol's Tucson sector. "Many people are being lied to by smugglers, which leads to deaths and illnesses, for the sole purpose of criminal profiting."