ISLAMABAD (AP) — Foreign Islamic militants have been able to secure Pakistani national identity cards for years in exchange for bribes as low as $100, giving them vastly greater freedom to operate, according to a report by Pakistan’s top intelligence agency obtained by The Associated Press.

The issue of foreign jihadis operating so easily in Pakistan has regional and even global implications. The country has long been a destination for aspiring global jihadis to receive training, some of whom are sent back abroad to conduct attacks. Foreign governments, particularly neighboring Afghanistan, have frequently accused elements of the Pakistani government of sheltering Islamic militant groups that frequent the porous and lawless tribal regions along the Afghan border.

According to the recent report by the Inter-Services Intelligence or ISI, thousands of foreigners have illegally obtained Pakistani national IDs. Most of them are Afghan refugees trying to have a more regular status, but they also include at least dozens of Islamic militants from China, the Maldives, Uzbekistan and the United States. Pakistani militants also often secured a second national ID card under a fake name, making it harder for local law enforcement to track and apprehend them, the report says.

“If the registration authority of any country is not corruption free, there are serious security concerns,” said Pakistani Interior Minister Chaudhry Nisar Ali Khan at a press conference in Islamabad on Aug. 23. Khan said he had set up a permanent committee of officers to work on ending the practice, adding, “We have prioritized it.”

Among the most notorious beneficiaries of this system was Adnan Shukrijumah, a Saudi-born U.S. citizen and a top al-Qaida commander. Shukrijumah was killed in a Pakistani army raid in a tribal region along the Afghan border in December 2014. He was found in possession of a Pakistani national identity card under the name of Shahzaib Khan, according to the ISI report.

The vast majority of those obtaining fake national IDs were Afghan refugees seeking to extend and legitimize their presence in Pakistan. But the loophole was also regularly exploited by foreign Islamic militants. The ISI report lists more than 40 foreign militants and their family members who had lived illegally in Pakistan— some of them wanted for terrorism-related charges in Pakistan or in their home countries.

Shukrijumah was on the FBI’s most wanted list with a $5 million reward for his capture offered by the U.S. government. Another example was Mohammed Amin, a native of the Maldives who was wanted by his government. Amin lived in Pakistan for four years with a fake ID; according to the ISI report, he fled the country in 2011 using a Pakistani passport.

The IDs were most useful for men like Shukrijumah, who could visually pass as Pakistanis. But even for foreign militants who looked distinctly foreign, the IDs could be used for renting apartments and vehicles, buying cell phones and SIM cards or wiring money.

The main fault in the ID scandal seems to lie with corruption in Pakistan’s National Data Registration Authority, or NADRA, the organization that issues national ID cards. An initial NADRA probe has termed the issuance of the ID cards to foreigners “a threat to national security” and recommended a fact-finding commission.

In a second NADRA internal report, seen by the AP, a low-level Pakistani clerk was found to have made millions of rupees, equivalent to tens of thousands of dollars, stashed in multiple bank accounts, by issuing fake ID cards to local al-Qaida-linked Sunni militants.

A NADRA spokesman, Samad Khurram, said that his department had already sacked 43 officials, including one director general, three directors and several other high profile employees — some of whom were arrested and charged with crimes including fraud and forgery.

Government prosecutor Manzoor Ahmad said that a court last week in the southwestern city of Quetta sentenced two NADRA officers to 20 years in prison each. Two lower-level employees received jail sentences of seven and four years.

On Tuesday, three NADRA offices in the southern city of Karachi were shut down and sealed, said Ashfaq Aalam Khan, a Federal Investigation Agency official, who is part of the taskforce probing the issue. He said his agency had already opened several inquiries after arresting six senior NADRA officials, and nearly 500 more cases being pursued against the employees and their partners and front men outside the government.

Khurram, the NADRA spokesman, said another 120 employees were still facing an internal inquiry. More than 29,000 fraudulent ID applications from foreign nationals were found in the system, Khurram said, adding that the majority were from Afghan refugees. Khan, the interior minister, said that some 80,000 fake ID cards had been blocked in the last four years.

Khurram wouldn’t say whether the removal from jobs and the inquiries were related to the ISI report. “We do not comment on an on-going inquiry,” he said.

A former chief of the anti-cybercrimes division at the Federal Investigation Agency, Ammar Jaffri, said the flood of fake IDs has already hindered authorities’ ability to track the communications and financial networks of terrorist groups.

“If you start tracking a terror plot or its financing in Europe or America, you may simply end up at a fake ID card issued in Pakistan,” he said.