Recent terror cases show security firms, police exposed to insider threat.

In an alarming trend, more and more Muslim terrorists are infiltrating the ranks of security firms and police departments, where they have acquired official IDs and uniforms to help gain access to secure areas, as well as firearms and tactical training to help carry out attacks.

Some jihadists posing as law enforcement officers have also gained access to classified federal databases to tip off other terrorist suspects under surveillance.

On Sept. 17, Somali-American Dahi Adan wore a security guard uniform as he stabbed or slashed 10 people at a St. Cloud, Minn., mall with a knife before he was shot and killed by an off-duty police officer. Adan made at least one reference to Allah during the stabbings and asked victims if they were Muslim before attacking. An ISIS affiliate claimed Adan was a “soldier of the Islamic State.”

Stockholm-based Securitas AB, a security firm that provides security services to companies in more than 200 cities worldwide, confirmed that Adan worked through June as a guard for its US division.

On the same day, Afghan-American Ahmad Rahami allegedly detonated a pressure-cooker bomb in the Chelsea neighborhood of New York that left 31 injured. A blood-soaked journal found on Rahami after he was shot by police indicated he was carrying out “jihad” against “nonbelievers” in their “backyard.”

Though Rahami was working for his family restaurant at the time, he aspired to be a police officer, according to friends and neighbors. He majored in criminal justice at Middlesex County College in Edison, N.J. Rahami was enrolled there from 2010-2012 but did not graduate.

Another Afghan-American terrorist, Omar Mateen, was employed as a security guard for a major federal security contractor this June, when he opened fire at an Orlando nightclub, killing 49 people. He had been dismissed from training as a prison guard after making threatening remarks, and ended up as a private security guard for G4S Secure Solutions USA Inc., which maintains a $234 million contract with the Department of Homeland Security.

Mateen was subject to a background check and psychological test when he was recruited by G4S in 2007 and rescreened in 2013 with no adverse findings — even though he threatened to kill a sheriff’s deputy at the St. Lucie County Courthouse where he was stationed as a security guard and had been placed on a terrorist watch list by the FBI.

“Omar became very agitated and made a comment that he could have al-Qaida kill my employee and his family,” St. Lucie County Sheriff Ken Mascara said. “If that wasn’t bad enough, he went on to say that the Fort Hood shooter was justified in his actions.”

As CounterJihad first reported, the Jupiter, Fla.-based security contractor G4S also provides security guards and other security services for “90 percent of U.S. nuclear facilities.”

In fact, G4S has the US Nuclear Regulatory Commission (NRC) contract to run simulated Red Team terrorist attacks on US nuclear plants and US nuclear weapons labs, CounterJihad has learned. G4S is managing the exercises, and its armed guards are participating in the force-on-force attacks, including mock terrorist strikes, which are designed to identify weaknesses and vulnerabilities in nuclear security.

CounterJihad has also learned that Senate investigators have been working with NRC’s Nuclear Security and Incident Response division to determine if there are other potential Mateens working as security guards at America’s nuclear facilities. A preliminary review has found that dozens of other Middle Easterners have landed jobs with nuclear reactor licensees as contract security guards — including a possible relative of Mateen. Only further scrutiny might identify insider threats among them.

It is far from an idle concern. In a 2011 intelligence report, Homeland Security warned that “violent extremists have, in fact, obtained insider positions” at nuclear facilities. Security experts fear opening nuclear security jobs to insufficiently vetted Muslims like Mateen risks inviting jihadists to exploit weaknesses and vulnerabilities in the security of US nuclear plants, as well as spent-fuel rod repositories and even the federal nuclear weapons labs.

“ISIS has nuclear facilities on their targeting radar, not only to secure fissile material for dirty bombs, but also to exploit the inherent vulnerability presented by overfilled spent fuel pools,” said Brian F. Sullivan, retired FAA special agent, retired Army lieutenant colonel in the military police corps and senior fellow at the American Leadership and Policy Foundation.

“Europe is well aware of this threat potential and the results could be devastating here in the United States, where our government has totally dropped the ball,” Sullivan added in a recent interview with CounterJihad. He said radioactive fallout from dirty nukes could render major US cities uninhabitable for years, if not decades.

Of increasing concern, meanwhile, are the operatives the terrorist front group Council on American-Islamic Relations is planting inside law enforcement agencies. CAIR is no friend of police. The group has published and distributed posters advising Muslims not to cooperate with FBI agents investigating terrorist suspects and to slam the door in their faces.

In Florida, for example, the Broward Sheriff’s Office employs a senior CAIR official, even though CAIR has been identified by the US Justice Department as a co-conspirator in funding terrorism and is so closely tied to the Hamas terrorist group that the FBI has banned CAIR from all its outreach activities nationwide.

Broward deputy sheriff Nezar Hamze doubles as regional director for CAIR in Florida, where he pushes CAIR’s Islamist agenda and defends Islam against criticism it promotes terrorism, most recently in the bloody wake of the Orlando terrorist attack by devout Muslim Omar Mateen, whose radical mosque was defended by a CAIR lawyer.

Broward Sheriff Scott Israel, who calls himself “Florida’s most progressive sheriff,” has ignored calls for Hamze’s removal from the force despite growing local protests.

Another CAIR executive, Khalid Latif, infiltrated the NYPD as its Muslim chaplain. Reportedly, Latif led the pilgrimage to Saudi Arabia that Mateen joined in 2012.

The case of Mohammad Weiss Rasool shows why such infiltration is potentially dangerous.

The FBI busted Rasool, an Afghan immigrant, for tipping off an al-Qaida terrorist suspect last decade while working as a police officer for the Fairfax County Police Department outside Washington and moonlighting for CAIR. He worked his way up to sergeant before authorities realized they had an al-Qaida spy in their ranks.

According to a Justice Department complaint filed in 2008, Rasool searched a national criminal database containing names of terrorist suspects and confirmed that FBI agents were tailing a Muslim friend of his from a local mosque.

When agents went to arrest the target early one morning, they found him and his family already dressed and destroying evidence. They knew they had a mole, and worked back through the system to find Rasool.

That’s when agents discovered the cop had breached their database at least 15 times to look up names of other contacts, including relatives, to see if they showed up on the federal terrorist watch list.

Rasool’s actions “damaged the integrity of the NCIC system and jeopardized at least one federal investigation,” prosecutors said in federal court papers. “The defendant’s actions could have placed federal agents in danger.”

Rasool at first claimed he didn’t know the terrorist target. He confessed only after hearing a recording of his message for the suspect, Abdullah Alnoshan — a close associate of al-Qaida cleric Anwar Awlaki, a local imam who had helped some of the 9/11 hijackers obtain housing and ID’s in Fairfax County.

Rasool finally pleaded guilty to illegally searching a federal database.

According to the bestselling book “Muslim Mafia,” Rasool at the time worked closely with CAIR, which lobbied on his behalf during his prosecution.

In fact, Rasool acted as CAIR’s liaison within the police department, and often met with CAIR officials at CAIR’s headquarters located just three blocks from the US Capitol.

A senior Fairfax County Police Department official, who called Rasool “a traitor” who “disgraced the uniform,” said he was “deeply embedded with CAIR.”

“He was the spokesman to the department for CAIR,” the official explained in “Muslim Mafia.”

The FBI has its own problems with Islamist moles.

Consider the case of the Muslim FBI agent in Los Angeles who allegedly compromised a multi-agency terrorism investigation by tipping off the ringleader of a Pakistani-based terror cell that the local Joint Terrorism Task Force (JTTF) had under surveillance for more than two years.

The “dirty” agent — an Egyptian-American married to an Afghan woman — allegedly sabotaged several investigations across the country, including ones in New York and Boston, that tie back to the Taliban in Pakistan. According to “Muslim Mafia,” he not only tipped the terror cell leader off to a so-called “trash cover” that investigators tried to execute outside his home in Los Angeles, but also identified surveillance vehicles for the terrorist suspect.

After an internal FBI investigation, the Muslim agent was reprimanded but not fired.

“The dirty FBI agent, my JTTF counterpart, compromised by investigation as well as several other agency investigations across the country,” said a detective who works counterterrorism intelligence for the LAPD. “The agent is embedded with the bad guys and gave them critical information detailing the investigations.”

The LAPD source added: “The FBI is covering it all up.”

Bureau tolerance for such betrayal by Muslim agents is not new.

Gamal Abdel-Hafiz, an Egyptian-American and the first Muslim FBI agent, twice refused on religious grounds to tape-record Muslim terrorist suspects under investigation, including his friend Sami al-Arian, who was later convicted in spite of Abdel-Hafiz gumming up the investigation.

In early 2001, then-FBI Director Louis Freeh picked Abdel-Hafiz to become the FBI’s deputy legal attache at the U.S. Embassy in Riyadh, Saudi Arabia — a key post in the battle against al-Qaida, which had hit American military barracks inside Saudi and a warship in neighboring Yemen.

After 9/11, when 15 of the 19 hijackers turned out to be Saudi nationals, Abdel-Hafiz was in a prime position to run down leads in the Saudi capital. Only, that didn’t happen, at least not as often as headquarters had hoped. Agents back in Washington complained about his performance there, saying they were not getting answers to the hundreds of leads they were sending him in Riyadh. Abdel-Hafiz says he was one of only two people manning the office there and was further hobbled by an antiquated computer system.

But he and his FBI boss Wilfred Rattigan, a black convert to Islam, had still found time to travel to Mecca for the annual pilgrimage, where they surrendered their FBI cell phones to Saudi nationals and were out of contact with officials back in the U.S. who were trying to ring them up about investigations into al-Qaida and 9/11. Both Rattigan and Abdel-Hafiz wore traditional Muslim headgear and robes while on the job in Saudi Arabia, further outraging fellow agents.

When a senior supervisor was sent to the Riyadh office nearly a year after 9/11, she found secret documents strewn all over the office, some even wedged between cabinets. She also found a huge backlog of boxes each filled with three feet of paper containing secret, time-sensitive leads. Much of the materials, including information on Saudi airline pilots, had not been translated or reviewed.

It’s anyone’s guess how many terror cases were compromised in the FBI’s Saudi office.

The FBI tried to fire Abdel-Hafiz in 2003 for insurance fraud and making false statements on his FBI application. But his termination was overruled by a special panel convened to hear the case, and he was reinstated. Reassigned to Dallas, Abdel-Hafiz recruited other Muslims to join the FBI at Islamic conferences held by Muslim Brotherhood front groups.

He finally retired last year, after being placed in the bureau’s post-adjudication risk management program, or PARM, which stripped him of access to certain classified material. He now works as a Homeland Security contractor advising on “countering violent extremism,” or CVE, the program the Obama administration started to pretend Islam has nothing to do with terrorism.

Among other things, Abdel-Hafiz argues against arresting young Muslim men who are being radicalized in order to build “trust” in the Muslim community.

Hundreds of other Muslim FBI agents, analysts, linguists and contractors have been subjected to additional security screening under the PARM program. The investigations have been prompted by concerns these FBI employees maintain family and other ties in the Middle East, as well as Afghanistan and Pakistan, and could be coerced by foreign spies or terrorist organizations to leak classified national security information.