Asad "Ace" Dandia, a 20-year-old college student and Brooklyn native, thought nothing of the Facebook friend request he approved in March 2012.

The 19-year-old at the other end of the exchange, Shamiur Rahman, told Dandia that he was struggling with a dark past and hoped to become a better Muslim. Rahman asked Dandia about "any events or anything" coming up. Dandia believed he was acting in accordance with his Muslim faith by inviting the young man to meet his friends in Fesabeelillah Services of NYC, an Islamic charity organization.

"I gladly took him. We bonded. We shared stories," Dandia said. "He would come to me and he would tell me how I changed his life and I helped him become a better person."

Seven months later, after inviting Rahman into his home for dinner with his family on numerous occasions and once hosting him overnight, Dandia learned the truth about Rahman. In a startling status update posted on Facebook, Rahman revealed he was an undercover informant, working for the New York City police department.

"I was terrified and I was afraid for my family, especially for my younger sister," Dandia said. "I felt betrayed and hurt because someone who I took as a friend and a brother was lying to me."

Dandia's ordeal is detailed in a new lawsuit that was filed in federal court on Tuesday, challenging the NYPD's surveillance of Muslim communities. Joined by the other plaintiffs in the suit – including two Muslim houses of worship, a Muslim charity, an imam and a Muslim father of two – Dandia delivered his story to the media and a crowd of supporters outside NYPD headquarters.

"How would you react if you found out that someone who spent a night in your house was an informant for the police department?" Dandia asked the crowd. "I was shocked that the police who were supposed to protect and serve me were spying on me, although I did nothing wrong."

Filed by the American Civil Liberties Union, the New York Civil Liberties Union and the Creating Law Enforcement Accountability (CLEAR) project of Main Street Legal Services at CUNY Law School, the suit accuses the NYPD of religious profiling and suspicion-less surveillance of Muslim New Yorkers. The suit calls for the destruction of all records on individuals created as a result of the department's surveillance and the appointment of an independent monitor to oversee the NYPD's intelligence gathering practices.

A growing debate

New York police commissioner Raymond Kelly. Photograph: Louis Lanzano/AP

The legal action comes as the nation continues to wrestle with a growing debate over security and privacy, ignited by leaks to the Guardian detailing the National Security Agency's expansive surveillance efforts.

"This suit seeks to enforce two of the constitution's most fundamental guarantees: freedom from discrimination and freedom of religion," said Hina Shamsi, director of the ACLU's National Security Project. "The NYPD has betrayed the expectations and violated the rights of New York's Muslims and it has betrayed, also, the expectations of all New Yorkers."

The NYPD's surveillance of Muslim communities was first revealed in detail in August 2011, in a Pulitzer Prize-winning investigative series by the Associated Press. The AP investigation detailed how, in the wake of September 11, NYPD commissioner Ray Kelly endeavored to transform elements of the nation's most powerful police force into a miniature CIA.

According to documents obtained by the AP, the NYPD's intelligence division developed a secret unit tasked with mapping the social, religious and business landscape of the greater New York area. The emphasis on Muslim communities was virtually exclusive and, according to one former police official, modeled in part on how Israeli authorities operate in the West Bank.

In an effort to uncover terrorist plots, so-called "rakers" or "mosque crawlers" – typically paid NYPD informants – were sent to Muslim student association meetings, businesses, universities, restaurants, whitewater rafting trips and more than 250 mosques in New York, New Jersey, Connecticut, Pennsylvania and elsewhere. The surveillance program was funded, in part, by a little-known White House grant for law enforcement organizations to access in the so-called war on drugs.

The CIA, which is prohibited from spying on Americans, was instrumental in developing the NYPD's surveillance program, at times continuing to pay personnel hired by the police department to mentor incoming officers. David Cohen, a veteran CIA officer with no police experience, was the architect of the NYPD's spy program. While serving as president Obama's top counterterrorism adviser, John Brennan, now director of the CIA, said he had "full confidence that the NYPD is doing things consistent with the law".

In defending its intelligence-gathering techniques, NYPD officials claim to have prevented 14 terrorist attacks since 11 September 2001 (though the NYPD's centrality and/or credibility in virtually every alleged plot has been called into question). According to the August 2012 sworn testimony of Lieutenant Paul Galati, chief of the NYPD intelligence division, the department's multi-state counterterrorism dragnet had so far failed to yield a single criminal lead. In an extended interview with the Wall Street Journal in April, Commissioner Kelly was asked if changes had been made to the NYPD's surveillance programs in the wake of the AP series. "No," he said.

'A false and unconstitutional premise'

Hina Shamsi, director of the ACLU's National Security Project, addresses the media outside NYPD headquarters. Photograph: Richard Drew/AP

On Tuesday, Hina Shamsi of the ACLU said: "Since 2002, the NYPD has carried out a policy and practice based on the false and unconstitutional premise that Muslim religious belief and practices are a basis for law-enforcement scrutiny. That is a premise rooted in bias and ignorance, not good law enforcement or fact."

Plaintiffs in the suit argue the NYPD's counterterrorism efforts have had a "profoundly" damaging impact on their religious goals, missions and practices.

In an email response to the Guardian, city attorney Celeste Koeleveld said: "The NYPD's strategic approach to combating terrorism is legal, appropriate and designed to keep our City safe. The NYPD recognizes the critical importance of 'on-the-ground' research, as police need to be informed about where a terrorist may go while planning or what they may do after an attack, as the Boston marathon bombing proved. Cities cannot play catch-up in gathering intelligence about a terrorist threat. Our results speak for themselves, with New York being the safest big city in America and the police having helped thwart several terrorist plots in recent years."

A Brooklyn imam, Hamid Hassan Raza, another plaintiff in the suit, said fear of surveillance had caused him to take specific precautions when conducting sermons, which in turn have hampered his ability to serve as a fully-functioning religious leader in his community.

"I have for years, taped the sermons I give because I am afraid an NYPD officer or an informant will misquote me or take a portion of a sermon out of context," Raza said. "I stopped mentioning in my sermons, or even as I counsel worshippers, current affairs or religious subjects that I fear the NYPD might object to."

Raza said that after the Boston bombings, for example, he neglected to discuss the attacks, out of fear of repercussions. Police documents uncovered by the AP indicate that Raza's house of worship, Masjid Al-Ansar, has been the subject of NYPD surveillance since at least 2008.

"I never know what the NYPD might question and I don't want to subject myself or my community to further police scrutiny or worse," Raza said. "Because of NYPD spying, I'm not able to fulfill my duty as an Imam. I'm constantly falling short of my obligations to my congregation."

Raza said that confirmation of an NYPD informant's presence in his house of worship caused attendance to drop and sowed seeds of suspicion towards newcomers. "Our once vibrant community has become even more scared and suspicious," Raza said. "I cannot believe that this has happened in the country that I know and love."