For Mayor Bill de Blasio, last week was one he’d like to forget. It started with brickbats over a botched plan for a blizzard that fizzled, and it was all downhill from there.

By the end, he was battling something more pernicious than either Mother Nature or Gov. Andrew Cuomo. That would be political allies whose actions point up once again the dangers of his radical anti-police agenda.

In a decision that earned City Hall and its lawyers a rare but justified outburst from top cop Bill Bratton, de Blasio’s team wrote a check to a machete-wielding thug who was shot by cops after he threatened them.

The payoff to Ruhim Ullah to drop his lawsuit was only $5,000, but the principle it represented — that cops who shot him did something wrong — sent Bratton into orbit.

“It’s outrageous that the city Law Department is continuing to not support the men and women of this department as they go about their duties,” he thundered. “Our cops work very hard trying to keep this city safe, and if they’re not going to be backed up by the city law office, we need to do something about this.”

The commish was still fuming when it emerged that lawyers under contract with the city to represent poor defendants had participated in a video calling for the execution of cops — and lied about it to city ­investigators.

The “Hands Up” music video advocates killing cops, among other despicable acts.YouTube

The Department of Investigation also accused the group’s executive director, Robin Steinberg, of making “misleading statements” to probers about the extent of the involvement.

For de Blasio, both incidents meant he had to call fouls on his own team. “There can be nothing that suggests any violence towards officers,” de Blasio said of the Bronx Defenders. “That’s absolutely unacceptable, it’s heinous, it’s reprehensible, it can’t happen.”

But it did happen, and the mayor should look in the mirror if he wants to know why. The video emerged during the turmoil of anti-police protests over the Eric Garner case, and de Blasio was defending and even encouraging the crowds right up to the point where two officers were assassinated.

There’s also another connection between de Blasio’s agenda and the Bronx Defenders. A private lawyer representing the group is a law partner with Richard Emery, whom de Blasio named to head the agency that investigates complaints against police. That partner, Earl Ward, is also board chairman of the Bronx Defenders, a fact first reported by The Daily Signal.

Similarly, just as de Blasio called the $5,000 payoff on the police shooting the result of a “broken policy,” it was his policy. He has made no secret of wanting to settle pending lawsuits quickly, without regard to the merits, which invites others to make frivolous claims.

Some settlements he approved have been outrageously expensive, with just three big cases carrying a price tag of $157 million: $98 million in a disputed class-action discrimination case in the Fire Department, $18 million to protesters arrested at the 2004 GOP national convention, and $41 million to the Central Park Five.

The city had good defenses in all three cases, yet the claims fit the worldview of de Blasio and his top adviser, Al Sharpton, that society is hopelessly racist and unfair.

The settlement of the Central Park jogger case was particularly contentious, with some lawyers arguing the city should not admit any wrongdoing because the teens had confessed and been convicted at trials that were upheld on appeal. Other critics said the $41 million settlement price was far higher than necessary.

The pattern is the problem. The mayor built his campaign on promises to tackle income inequality, but seems more determined to wage class warfare and handcuff law enforcement.

His attacks on police, followed by the assassinations, earned him the contempt of many in the NYPD and threw into doubt whether de Blasio is capable of making the transition from candidate to mayor.

More than a year into his term, incidents like the $5,000 payoff and the Bronx Defenders’ video underscore his steep learning curve and force him to play defense against his own team. His chickens are coming home to roost.

Although he can never admit he has screwed up, an optimist could argue that he’s learning from his mistakes. The pessimist doubts his ability to stop making them.

The real issue was the lack of surprise over the possibility that a second member of Albany’s ruling troika would end up in handcuffs. After the bust of Assembly Speaker Sheldon Silver, and federal prosecutor Preet Bharara’s declaration to “stay tuned,” it will be a shock only if nobody else gets arrested.

Skelos, the Senate majority leader, is, like Silver, under investigation in connection with his outside income, according to WNBC/Channel 4. The Long Island Republican serves as counsel to a law firm that specializes in real estate and reported earning as much as $250,000 last year. What he does for the money is unclear.

That’s the fact pattern that led to the Silver probe. He earned an average of $500,000 a year from Weitz & Luxenberg, and Bharara charged he failed to disclose as much as $700,000 in additional income from a second firm. The federal complaint charges that $4 million of Silver’s outside earnings were bribes and kickbacks.

There is a rich irony in the possibility that leaders of both legislative houses, one a Democrat, one a Republican, would simultaneously face corruption charges. In the words of my late friend and colleague Sidney Zion, Albany long has been “two parties against the people.”

Zion’s keen insight was that, rather than adversaries, New York’s political parties are most often co-conspirators. Instead of fighting over the spoils, they create more of them so everybody gets rich.

Everybody, that is, except taxpayers. They get screwed.

Call ’em the GoodShellas

Reader Steve Becker offers to improve my reference to Sheldon Silver’s mob-style control in Albany. Instead of La Cosa Nostra’s government family, Becker says it should be La Kosher Nostra.