Over the weekend, young toughs with buckets full of water randomly soaked cops in Harlem and Brownsville just for the hell of it. At one point, an officer got conked on the head by an empty plastic bucket — to the vast amusement of jeering onlookers.

It was apparently an internet challenge sort of thing — and a horrifying sight, at least to those who understand the implications of unchallenged anarchic public behavior.

But it should have surprised no one.

The NYPD, under orders from City Hall, has been standing down for years now — watching fare-beaters beating fares, pot-dealers dealing pot and addicts and insane people defecating in the streets, all without consequence.

And the street people have been watching the cops watching them, but without objection, and all of a sudden the penny drops — Pax Giuliana is over, and now the bad guys believe they can get away with anything.

If the bucket-brigade action is fair testimony, they can.

The irony is that Mayor Running-for-President set out to rid the city of broken-windows policing — the well-tested notion that little crimes left unaddressed beget bigger crimes — and he succeeded. Now the subways stink of urine and it has all come roaring back.

When an in-your-face town like New York suddenly realizes that City Hall tolerates minor crime — as a matter of social equity, no less — it gets more of it, fast. Presently, citizens are pouring water on cops. One shudders to think what comes next.

Tuesday the usual suspects were on about how wonderfully restrained the officers were in response — as if, given present circumstances, they had any choice.

But make no mistake: The cops were victims of a crime — assault on a police officer — and the bucket-to-the-head could have been charged as a Class D felony.

Worse, the cops looked absurd as they sloshed away, heads bowed and humiliated.

This is all very dangerous stuff — because cops who are made to look absurd in public will be regarded as absurd by the public. The command presence backed by the moral authority of the city will have evaporated — and Gotham will have taken a giant step back to the Lindsay administration’s potted-plant approached to policing: Roll up and take a crime report, but only when necessary, and otherwise stay out of sight.

Anybody wondering how that story ends should just stream “Taxi Driver.”

Obviously, Bill de Blasio never saw it. While Lindsay presided over a catastrophic decline in public safety, Kaiser Wilhelm is hell-bent on accelerating one of his own — largely because, like Lindsay, he panders to constituencies that have trouble distinguishing between criminals and their victims.

Layer on top of that de Blasio’s embrace of disparate impact in policing — the notion that minorities are overcharged relative to their numbers in the community, never mind that minorities tend disproportionately to be victimized by other minorities — and the table is set for real trouble.

Oh, sure, the official statistics suggest the city remains safe. But de Blasio’s crew is hard pressed to tell the truth about anything, let alone embarrassing stats; guns are going off in disturbingly large numbers all over town; Comptroller Scott Stringer is an astonishingly uncurious watchdog — and the city hasn’t felt this chaotic since the Dinkins administration.

If ever there was a time for One Police Plaza to stand tall, this is it. And maybe that’s going to happen.

“Our detectives are looking for who was involved [in the bucket incidents], and arrests will be made,” said NYPD chief of department Terence Monahan Tuesday. “That is not acceptable to our men and women who are out there.”

So far, so good.

But while arrests are necessary, they will not be enough.

The real test will be of Bill de Blasio, the architect of a public safety circumstance now morphing from fiasco to crisis, and the man who inherited the finest big-city police department in the world.

It’s time for him to put it back to work.

Bob McManus is a contributing editor of City Journal. Follow him on Twitter at @rlmac2.