WASHINGTON (AP) — New York's police commissioner confirmed Thursday that a CIA officer is working out of police headquarters there, after an Associated Press investigation revealed an unusual partnership with the CIA that has blurred the line between foreign and domestic spying. But he and the CIA said the spy agency's role at the department is an advisory one.

Speaking to reporters in New York, commissioner Raymond Kelly acknowledged that the CIA trains NYPD officers on "trade craft issues," meaning espionage techniques, and advises police about events happening overseas. Kelly also said he was unaware of any other U.S. police department with a similar relationship with the CIA.

"They are involved in providing us with information, usually coming from perhaps overseas and providing it to us for, you know, just for our purposes," Kelly said.

CIA spokeswoman Jennifer Youngblood said the agency does not spy inside the United States and also described the relationship with the NYPD as collaborative.

"Our cooperation, in coordination with the Federal Bureau of Investigation, is exactly what the American people deserve and have come to expect following 9/11," she said.

A months-long investigation by the AP, published Wednesday, revealed that the NYPD has dispatched teams of undercover officers, known as "rakers," into minority neighborhoods as part of a human mapping program, according to officials directly involved in the program. They've monitored daily life in bookstores, bars, cafes and nightclubs. Police have also used informants, known as "mosque crawlers," to monitor sermons, even when there's no evidence of wrongdoing. NYPD officials have scrutinized imams and gathered intelligence on cab drivers and food cart vendors, jobs often done by Muslims.

Many of the operations were built with help from the CIA, which is prohibited from spying on Americans but was instrumental in transforming the NYPD's intelligence unit after the Sept. 11, 2001, terror attacks.

The NYPD denied that it trolls ethnic neighborhoods and said it only follows leads. The mayor on Thursday defended the police department's efforts.

"In the end the NYPD's first job is prevention, and I think they've done a very good job of that," New York Mayor Michael Bloomberg said when asked about the police practices. "The law is pretty clear about what's the requirement, and I think they've followed the law."

Also Thursday, New York City Councilman Brad Lander said the city council should conduct an oversight hearing on the NYPD's programs, but Lander is not in a leadership position to enforce that such hearings take place.

"We must be sure that the NYPD's intelligence gathering does not violate civil liberties, target and profile our city's diverse ethnic and religious communities," Lander said.

City Councilman Peter Vallone, chairman of the panel that oversees the police department, said the council already had scheduled two NYPD oversight hearings during which these issues could be raised.

The disclosures about the NYPD's activities provoked exasperation in the city's Muslim neighborhoods, where government officials have sought to build relationships in Muslim communities and pledged to ensure that Muslims aren't targeted for discrimination.

"The NYPD's credibility is bankrupt in our communities," Fahd Ahmed, legal and policy director of the Desis Rising Up & Moving group, said in a statement Thursday. "We need accountability, transparency and an overhaul of tactics and policies."

Government outreach programs have operated in Boston, Cleveland, Detroit, Minneapolis, Portland, Ore., and Washington — all cities with large Muslim communities — even as law enforcement around the country has stepped up investigative efforts to stave off attacks.

But the inherent tensions caused by this duality of missions is perhaps most visible in New York. It is the only U.S. city that al-Qaida has successfully attacked twice and continues to be the target of terror plots. New York also is home to the country's most aggressive local police department investigating counterterrorism.

"It seems to many of the leadership here, there are two kinds of authorities they are playing — one is in the forefront which is very cooperative," said Zaheer Uddin of the Islamic Leadership Council of New York. "And there is another authority, which is playing against Islam and Muslims, going against the First Amendment and the security of this country."

Uddin asked, "Are we partners, or are we a suspicious community?"

On Wednesday, the Justice Department said it will review a request by a Muslim advocacy group to investigate.

"These revelations send the message to American Muslims that they are being viewed as a suspect community and that their constitutional rights may be violated with impunity," said Ibrahim Hooper, spokesman for the Council on American-Islamic Relations, which asked for the investigation. "The Justice Department must initiate an immediate investigation of the civil rights implications of this spy program and the legality of its links to the CIA."

In the decade since the September 2001 attacks, government officials in New York also have met with Muslim leaders and exchanged cellphone numbers. They've attended religious services, dinners and teas, and spoken at community meetings. The FBI recently hosted an event for 500 young Muslims in Brooklyn to build trust and get to know federal law enforcement, with a bomb-sniffing dog, scuba boat and helicopter on display.

"I go and visit mosques on a regular basis," Kelly previously told the AP, adding that he also holds question-and-answer sessions and planned to attend several dinners with members of the Muslim community during the holy month of Ramadan this year.

The police department in 2006 hired Sidique Wai, an African immigrant and member of the New York Muslim community, to coordinate the NYPD's citywide community outreach program. He said the interaction and outreach between the community and police is unprecedented.

"The majority of the faith-based — particularly the Muslim leaders throughout the city — are absolutely appreciative of the unprecedented relationship with the police department," Wai said. "I'm not aware of a deliberate effort on the part of NYPD to profile people."

___

Associated Press writer Samantha Gross in New York City contributed to this report.