FINE EXAMPLE: The next mayor and top cop must follow the lead of Police Commissioner Ray Kelly and Mayor Bloomberg, here at City Hall yesterday, who have partnered in keeping New York City safe since 9/11. Photo: AP

FINE EXAMPLE: The next mayor and top cop must follow the lead of Police Commissioner Ray Kelly and Mayor Bloomberg, here at City Hall yesterday, who have partnered in keeping New York City safe since 9/11. (
)

With their tag-team press conference yesterday, Mayor Bloomberg and Police Commissioner Ray Kelly assured New Yorkers that they are doing all they can to keep the city safe. Their performance was crisp and steady, just as we have come to expect from them in nervous times like these.

Then again, they are not the problem. In addition to record-low crime rates, the duo miraculously guided New York through the terror epidemic of the last decade, with the city not suffering a successful attack since 9/11.

This shutout was not just a matter of luck, with police helping to foil 16 plots, largely through the work of the NYPD’s 1,000-strong counterterrorism unit.

So as Bloomberg and Kelly fielded questions about the city’s added preparations, I found their sharpness comforting. They have earned our trust by taking nothing for granted.

It’s the performance of the next mayor and next top cop that has me and many other New Yorkers scared.

Some of those who want to be mayor have a horrible habit of distancing themselves from the police, and others have shown signs of being openly anti-cop. The pandering always looked foolish, but, against the backdrop of Boston, it looks foolishly dangerous.

The marathon attacks should set off alarms to New York’s candidates and voters. It’s time to stop knocking the NYPD. While the department is far from perfect, it will be much easier to break its morale and damage its performance than to make it better.

As the Boston attack proved, terror, whether home-grown or foreign-based, can strike at any time. Despite President Obama’s assertion that the “tide of war is receding” on foreign battlefields, the home front remains extremely dangerous.

And New York remains the No. 1 target. As Kelly often says, the terrorists “always want to come back here.”

America’s military and federal law-enforcement and intelligence officials are the first lines of defense, but especially with routine “soft” targets like sporting events, local police are often the only authorities on the scene.

A candidate who gets elected with an anti-police mindset surely will come to regret that after taking office. Yet that’s pretty much the path the Democrats are following now. Locked in a bitter primary for liberal and union votes, they are teaming up with activists like the ACLU to use Kelly as a pinata.

The main focus has been on stop-and-frisk, a tactic Kelly says plays a key role in pushing the city’s murder rate to historic lows.

Yet the candidates see political gold in making the tactic an issue, with Council Speaker Christine Quinn, the leader of the field, using stop-and-frisk as an excuse to promise an inspector general to oversee the department.

That could be big trouble not just for taking illegal handguns and other weapons off the street, but also for any of the bold anti-terror initiatives Kelly has created and Bloomberg has blessed. The controversial surveillance of Muslim groups and some mosques, the expensive counter-terror units and the practice of having detectives stationed abroad to give the city a quick jump on intelligence after other attacks — none of these is a luxury. They are proven parts of a successful strategy, yet all could be sacrificed for cheap applause or trimmed to save money.

But doing away with those initiatives would almost certainly make New York less safe. With the growing global disorder, in part a reflection of American retreat, aggression against us is almost certain to grow. The city needs more protection, not less.

Even under the best of circumstances, a new mayor finds that ensuring public safety is the most difficult and most important part of the job. That is especially true now.

And there is little room for error. Everything that makes New York a world capital, from the financial and real-estate market to job creation to its culture and entertainment attractions, depends on the success of the NYPD. One successful attack could be devastating.

Preventing that scenario will be a burden on the shoulders of the next mayor, ready or not. Now is the time to get ready.

Boston must be a wake-up call for all the candidates. Instead of bashing the police, they should begin recognizing the NYPD for what is: the last line of defense of New York.

Instead of bashing Bloomberg and Kelly, they should study their success and pledge to also keep New York safe.

If they do all that, the candidates will understand that public safety is not just luck. It is the ultimate test of leadership.