A top Texas law enforcement agency says border security organizations have apprehended several members of known Islamist terrorist organizations crossing the southern border in recent years, and while a surge of officers to the border has slowed the flow of drugs and undocumented immigrants, it’s costing the state tens of millions of dollars.

In a report to Texas elected officials, the state Department of Public Safety says border security agencies have arrested several Somali immigrants crossing the southern border who are known members of al-Shabab, the terrorist group that launched a deadly attack on the Westgate shopping mall in Nairobi, Kenya, and Al-Itihaad al-Islamiya, another Somalia-based group once funded by Osama bin Laden. Another undocumented immigrant arrested crossing the border was on multiple U.S. terrorism watch lists, the report says.

According to the report, one member of al-Shabab, apprehended in June 2014, told authorities he had been trained for an April 2014 suicide attack in Mogadishu. He said he escaped and reported the planned attack to African Union troops, who were able to stop the attack. The FBI believed another undocumented immigrant was an al-Shabab member who helped smuggle several potentially dangerous terrorists into the U.S.

Authorities also apprehended immigrants who said they were members of terrorist organizations in Sri Lanka and Bangladesh.

The Department of Public Safety said the report, first published by the Houston Chronicle, was not meant for public distribution.

“[T]hat report was inappropriately obtained and [the Chronicle was] not authorized to possess or post the law enforcement sensitive document,” department press secretary Tom Vinger said in an e-mail.

U.S. Customs and Border Protection did not respond to requests for comment.

The department said it had come into contact in recent years with “special interest aliens,” who come from countries with known ties to terrorists or where terrorist groups thrive. Those arrested include Afghans, Iranians, Iraqis, Syrians, Libyans and Pakistanis. In all, immigrants from 35 countries in Asia and the Middle East have been arrested over the past few years in the Rio Grande Valley.

The department says there is no known intelligence that specifically links undocumented immigrants to terrorism plots, but the authors warn it’s almost certain that foreign terrorist organizations know of the porous border between the U.S. and Mexico.

“It is important to note that an unsecure border is a vulnerability that can be exploited by criminals of all kinds,” Vinger said. “And it would be naive to rule out the possibility that any criminal organizations around the world, including terrorists, would not look for opportunities to take advantage of security gaps along our country’s international border.”

Even without the threat of foreign terrorists making their way across the border, Texas law enforcement officials say seven of the eight major Mexican drug cartels operate throughout Texas.

Those cartels have sent assassins as far north as the Dallas-Fort Worth area to commit murders, and the drug trade is thriving. The cartels are also branching into sex trafficking, which can present a lower risk and yield a higher profit than the drug trade, the report says. Law enforcement officials have uncovered major trafficking rings operating in Texas, Georgia, Mississippi, Alabama, Louisiana, Tennessee and several east coast cities.

Almost all human smuggling rings have ties to the Mexican drug cartels, the report found, and in many cases undocumented immigrants are kept locked in small, confined spaces where they go days without food or water. Law enforcement officials found one “stash house” in the Houston area crammed with 115 illegal immigrants.

The report says the Gulf, Zeta, Juarez and Sinaloa cartels have the most prominent footprints in Texas. Officials are also worried about the growing influence of MS-13, the Salvadoran gang that originated in Los Angeles.

The cartels have been “effective in corrupting U.S. law enforcement officials at all levels,” the DPS report says.

But the surge of Texas DPS officers, National Guard troops and other law enforcement officials, ordered by then-Gov. Rick Perry (R) last June, has worked to stem last year’s flood of undocumented immigrants crossing into the Rio Grande Valley.

Border officials apprehended 313,000 immigrants in FY 2014, nearly three times the number caught in FY 2011. In recent months, that number has diminished significantly. The report said the number of arrests per week had fallen from a high of about 6,000 to around 2,000.

The surge has also led to the seizure of more than $1.8 billion worth of cartel drugs, or about 150 tons of marijuana, 588 pounds of cocaine and 320 pounds of methamphetamines. Cartels have shifted marijuana trafficking west, from McAllen to the small towns of Escobares and Roma.

The cartels are sending scouts to watch U.S. border patrol officers, and they believe the Texas border surge will end soon, once the money runs out, according to intelligence collected by the Department of Public Safety.

It is not without costs. DPS said the state and National Guard have spent more than $102 million deploying troops and officers and bolstering surveillance capabilities. The state has already installed 1,224 surveillance cameras along the border, and another 4,000 cameras will be installed in the coming months.

Fully securing the border would require the constant presence of an incredible number of troops — as many as 76,000, the report found. This summer, the surge sent about 1,000 National Guard soldiers to the border.