A federal appeals court in Philadelphia Tuesday reinstated a civil rights lawsuit over the NYPD's surveillance of Muslims, ruling that claimed public safety and national security concerns did not justify discriminatory scrutiny.

"We have been down similar roads before," the 3rd U.S. Circuit Court of Appeals said. "Jewish-Americans during the Red Scare, African-Americans during the Civil Rights Movement, and Japanese-Americans during World War II are examples that readily spring to mind.

"We are left to wonder why we cannot see with foresight what we see so clearly with hindsight -- that loyalty is a matter of the heart and mind, not race, creed, or color."

The court said the NYPD program, revealed in Associated Press stories in 2011 and 2012, used surveillance, informants and other methods to gather information on mosques and Muslim schools and communities in New York, New Jersey and other states.

The plaintiffs -- including a Muslim soldier, students, mosques and businesses -- sued in Newark federal court to stop NYPD spying on Muslims in New Jersey, to expunge records and for damages. The trial court dismissed the suit, finding that they lacked standing and that the city's intent was to catch terrorists, not to discriminate.

But the 3rd Circuit said people whose religion and mosques were the targets of discriminatory treatment had standing, and if the allegations were true the city's public safety motivations did not justify targeting one religion for different treatment.

"Even if NYPD officers were subjectively motivated by a legitimate law-enforcement purpose (no matter how sincere), they've intentionally discriminated if they wouldn't have surveilled Plaintiffs had they not been Muslim," the court wrote.

After taking over at the NYPD last year, Commissioner William Bratton disbanded the so-called "demographics unit," which conducted Muslim surveillance and spying activities, but it has remained unclear what activities are still being carried out by other divisions.

advertisement | advertise on newsday

A spokesman for the New York City law department said Tuesday that the ruling was being reviewed, but noted that the appeals court had only ruled the case could go forward and did not make a finding on the merits that the city had violated the law.

"At this stage, the issue is whether the NYPD in fact surveilled individuals and businesses solely because they are Muslim, something the NYPD has never condoned," the spokesman said. "Stigmatizing a group based on its religion is contrary to our values."

The city has reached a confidential agreement in principle to settle two similar suits over its Muslim surveillance program in federal courts in Brooklyn and Manhattan. Unlike the New Jersey case, those suits do not seek monetary damages.

Lawyers for the plaintiffs praised the ruling.

"The court reaffirmed the elementary principle that . . . courts cannot simply accept untested claims about national security to justify a gross stereotype about Muslims," said Baher Azmy, director of the Center for Constitutional Rights in Manhattan. "There is no Muslim exception to the Constitution."

Get the Newsday Now newsletter!

The best of Newsday every day in your inbox.

Azmy also complained that Mayor Bill de Blasio, who had stopped the city's legal fight over allegations that NYPD stop-and-frisk policies violated the Constitution, continued to support Muslim surveillance.

"This case of religious profiling," he said in a statement, "is the other side of the stop-and-frisk coin, yet the de Blasio administration . . . still defends this form of outright discrimination against Muslims."