Maybe the Muslim community in New Jersey should sue the Associated Press. The wire service won a Pulitzer Prize for its coverage exposing the surveillance of the Muslim community that was done by the NYPD after 9/11 — but a federal judge seems to think there were some unintended consequences.

Muslims in Jersey complained of feeling the effects of the surveillance only after it became widely known that the NYPD was doing it there in the first place. Several filed suit against New York City, complaining, as the judge summarized it, that the surveillance caused “a series of spiritual, stigmatic and pecuniary losses.”

This presents a novel problem for the press. I’ve been working for newspapers for decades and haven’t seen a situation quite like it. The AP no doubt felt it was trying to help the Muslim community that was being spied upon — but it ended up compounding their problem.

Don’t take it from me. Read the opinion of the Honorable William Martini.

Six Muslim individuals, two groups that run mosques, two Muslim-owned businesses and the Muslim Students Association at Rutgers brought the case to Martini’s courtroom. They argued that the NYPD surveillance program “targeted Muslims solely on the basis of religion.”

It turns out that this started in early 2002, when the NYPD began, as Martini put it, “to infiltrate and monitor” Muslim life in New York, including what the plaintiffs call “painstaking” documentation of Muslim life in the Garden State. NY cops used cameras on light poles to watch mosques, collected license plate numbers, infiltrated organizations and “monitored sermons, meetings, conversations and religious practices.”

Cops also wrote reports that “named specific individuals without any evidence of wrongdoing,” the plaintiffs complained, and labeled some groups as “Locations of Concern,” which meant they’d demonstrated “a significant pattern of illegal activity.” The plaintiffs say that label was “false and stigmatizing” because there was no evidence of illegal activity and it violated their rights to free exercise of religion and equal protection of the laws.

Judge Martini didn’t buy it. The plaintiffs, he wrote, “have not alleged facts from which it can be plausibly inferred that they were targeted solely because of their religion. The more likely explanation for the surveillance was a desire to locate budding terrorist conspiracies.”

“The most obvious reason for so concluding,” he added, “is that surveillance of the Muslim community began just after the attacks of Sept. 11, 2001. The police could not have monitored New Jersey for Muslim terrorist activities without monitoring the Muslim community itself.” If there were a Pulitzer Prize for common sense, Martini would be a good candidate.

“While this surveillance program may have had adverse effects upon the Muslim community after the Associated Press published its articles,” wrote the judge as he threw out the case, “the motive . . . was not solely to discriminate against Muslims, but rather to find Muslim terrorists hiding among ordinary, law-abiding Muslims.”

So what about those law-abiding Muslims? They’re not to blame for 9/11. They’re protected by the same Constitution that all of us are.

This is where Martini almost invited the question of whether they could sue the Associated Press. He notes that the defendant, New York City, argues that the AP and not the city is the manifest cause of the alleged injuries to the Muslim plaintiffs — and doesn’t sneer at that argument. On the contrary: “None of the plaintiffs’ injuries arose until after the Associated Press released unredacted, confidential NYPD documents and articles expressing its own interpretation of those documents. Nowhere in the complaint do plaintiffs allege that they suffered harm prior to the unauthorized release of the documents by the Associated Press.”

That, says the judge, “confirms that plaintiffs’ alleged injuries flow from the Associated Press’s unauthorized disclosure of the documents. The harms are not ‘fairly traceable’ to any act of surveillance.” That echoes a blunt point made by New York City, namely that the Muslim plaintiffs didn’t accuse the police of making the disclosures.

Will anyone sue the AP? I’d be against it, even though I’ve been highly critical of the AP coverage as way too negative toward the NYPD. No editor will blame the messenger.

But if the Muslim plaintiffs in New Jersey do turn around and sue the AP, the wire service had better hope that the case doesn’t land in the court of Judge William Martini.