NEW YORK (AP) — The New York Police Department had legitimate reasons to put specific mosques and Muslim worshippers under surveillance as part of its counterterrorism efforts, a city lawyer said Thursday at the first court date in a civil rights lawsuit accusing the NYPD of religious profiling.

Peter Farrell of the city Law Department argued that before the case goes forward, the city should be allowed to present evidence specific to the six plaintiffs that he said would prove police were acting with legitimate law enforcement purposes. If the judge agrees, "then this case is over," he said.

An American Civil Liberties Union attorney, Hina Shamsi, countered that her clients already had sufficient legal standing to sue the city and that the NYPD should be ordered to begin turning over sensitive reports and documents detailing the alleged spying on Muslims.

U.S. Magistrate Joan Azrack said she would rule at a later date.

The suit was filed in June following a series of Associated Press reports, detailing the NYPD's Muslim surveillance programs. It alleges that the programs undermined free worship by innocent people and asked the court to halt the surveillance.

In a letter filed on Tuesday, city lawyers outlined evidence they say shows that a security team at a mosque named as a plaintiff in the suit sponsored survival training outings and referred to team members as "jihad warriors." Another plaintiff mosque was frequented by a man convicted earlier this year of lying to the FBI about plans to team up with the Taliban or al-Qaida, the letter said.

An NYPD investigation of a third plaintiff, college student Asad Dandia, "is based on information that he has made statements and conducted activities in support of violent jihad," the letter said. Dandia also "attempted to organize a trip to Pakistan in 2011 to train and fight alongside extremist elements there," it added.

An NYPD informant acknowledged last year in an interview with the AP that he had spied on Dandia and others.

Story continues

The NYPD didn't target particular mosques "simply because the attendees were Muslim," the letter said. "Rather, the NYPD followed leads suggesting that certain individuals in certain mosques may be engaging in criminal and possibly terrorist activity."

In response, the ACLU accused the city of vilifying its clients "through inflammatory and insinuation and innuendo, suggesting (they) are worthy of criminal investigation on the basis of First Amendment-protected speech, activities or attenuated — and unwitting — association alone."

It added: "This strategy is a deliberate distraction at best. At worst, it verges on the very type of discriminatory and meritless profiling at the heart of this case."

Last month, the AP reported that confidential documents show that the NYPD has secretly labeled entire mosques as terrorist organizations, a designation that allows police to use informants to record sermons and spy on worshippers. Police officials have insisted that the department only acts on legitimate leads about terror threats.