Most Americans think that the CIA works overseas while the FBI and local police protect them at home. But the agency has long worked domestically, and in the last decade it has become involved in counterterrorism operations with local police as well.

A recent report by the CIA’s inspector general shows that such cooperation can easily go wrong. Between 2002 and 2012 the CIA sent four agents to help the NYPD’s counterterrorism unit (which is led by a former agency official) without making sure that they knew the limits of what they could and couldn’t do. According to the inspector general, this type of “close and direct collaboration with any local domestic police department” could lead to the perception that the agency had “exceeded its authorities.”

But the problem goes far beyond one of perception. We should be concerned that CIA involvement with local police will influence them to adopt a counterinsurgency mentality that is simply not warranted on home turf. When deployed in Iraq or Afghanistan, the agency has to assume that it is working in a hostile environment. It’s operations are necessarily covert. It is not restrained by the full panoply of constitutional rules that apply at home.

One cannot help but wonder whether a CIA mentality helped shape the NYPD’s Muslim surveillance program. A Pulitzer Prize-winning investigation by the Associated Press has shown that police officers monitored every aspect of the lives of Muslim New Yorkers [since 9/11]. They secretly mapped out Muslim communities, noting the details of bookstores, barbershops and cafes. Informants in mosques reported on religious beliefs and political views that had nothing to do with terrorism. Muslim student groups across the Northeast were watched. All of this information, however innocuous or irrelevant to its purported counterterrorism purpose, landed in police files. It sure sounds like a program directed at a hostile population rather than a community with an exemplary record for cooperating with law enforcement.

One counterinsurgency lesson that the CIA apparently failed to teach the NYPD was how aggressive tactics could alienate local populations. The NYPD’s surveillance program has severely damaged the police’s relationship with the Muslim community, leading to protests and lawsuits. The CIA’s involvement can only make American Muslims feel that they are being targeted by the entire U.S. government. Such perceptions undermine everyone’s safety. Decades of policing research shows that communities that do not trust law enforcement are less likely to come forward and share information.

There is also good reason for the perception that the CIA exceeded its authorities during its NYPD partnership. When the CIA was created in 1947, lawmakers instructed it not to exercise “police, subpoena, or law enforcement powers or domestic security functions.” Congress’s aim to prevent Agency operations at home is plain, but the exact nature of forbidden “domestic security functions” is now defined in large part by secret rules.

What is known about the CIA’s authority is mostly contained in Executive Order 12333, first issued by President Ronald Reagan and updated by later presidents. This order allows the agency to perform some domestic functions, including assisting federal agencies and local police. For example, the CIA is allowed to “participate in law enforcement activities to investigate or prevent” international terrorism. This should mean that CIA agents are kept away from purely domestic investigations. But according to the inspector general’s report, a loaned CIA agent overseeing NYPD investigations “did not receive briefings on the law enforcement restrictions” and believed there were “no limitations” on his activities. Another CIA operative admitted receiving “unfiltered” reports containing information about U.S. citizens unrelated to international terrorism.

The rules governing the agency’s involvement in domestic matters are very flexible, but the few safeguards that are in place should be taken seriously. The inspector general’s report showed that these standards were not met, but shied away from calling out illegality and from holding anyone responsible. Indeed, the inspector general did not even believe a full investigation was warranted. Congress might want to ask why.

Nor did the inspector general address the risk that CIA tactics honed in wars abroad could influence police operations at home. The agency should seriously evaluate this likelihood before assigning its personnel to police departments, as should the Congressional committees responsible for overseeing the intelligence community. Brooklyn is not Baghdad. American Muslim communities deserve to be treated as partners in the fight against terrorism and crime, not as hostile foreign populations.

Faiza Patel is co-director of the Liberty and National Security Program at the Brennan Centre for Justice. She is also a member of the United Nations Human Rights Council's Working Group on the Use of Mercenaries.

Daniel Michelson-Horowitz is a legal intern with the Brennan Center for Justice.