Opinion

Ray was right

The NYPD and its former boss, Ray Kelly, got two big wins in their war on terror last week. Let’s hope their critics draw appropriate lessons.

In Newark, US District Judge William Martini tossed a lawsuit against the NYPD’s surveillance of Muslim communities. It was a clear-cut vindication of the cops and their anti-terror programs.

Martini rejected claims that the NYPD practiced discrimination in its surveillance of Newark mosques: “The plaintiffs in this case,” 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.”

In short, the cops were doing essential work — checking places that could harbor individuals wishing to do harm to the city.

So much for slurs of bias against the ­department.

The day before Martini’s decision, the NYPD scored another victory: Word came that José Pimentel (a k a Muhammad Yusuf) had pleaded guilty to plotting to bomb the city. As a result, he faces 16 years in prison when sentenced next month.

The Dominican-born Pimentel is one more home-grown terrorist. Despite being raised in Manhattan, he turned against his adopted home in the name of jihad.

The FBI pooh-poohed the case, and Pimentel’s lawyers initially claimed that the NYPD’s use of a questionable informant cast doubt on the likelihood of a conviction. Nonetheless, Manhattan DA Cy Vance, pressed ahead — and Pimentel took the plea before going to trial.

One other note: Martini’s verdict is a repudiation of the Associated Press’ inflammatory and misleading series on NYPD Muslim “spying,” which won it a Pulitzer.

Perhap the AP should return the prize.

As a candidate, Bill de Blasio vowed to rein in NYPD surveillance practices. Let’s hope the department’s two-fisted court vindication leads him to rethink that ­approach.