A federal judge has thrown out a civil rights lawsuit challenging the New York Police Department's surveillance of Muslims in New Jersey.

Judge William Martini in Newark, N.J., ruled Thursday that the plaintiffs hadn't shown that the NYPD's intelligence unit had discriminated against them by spying on mosques and other locations in New Jersey.

The Center for Constitutional Rights, which represented the plaintiffs, warned the ruling could give the green light to spying on Muslims anywhere in the country. The city's Law Department had no immediate comment.

The 2012 lawsuit was the first to challenge the NYPD's surveillance programs chronicling life in entire Muslim neighborhoods. The surveillance was the subject of series of stories by The Associated Press that revealed the NYPD infiltrated dozens of mosques and Muslim student groups and investigated hundreds.