An axiom of politics says an effort to take out a leader must be strong enough to guarantee success, lest it leave the leader wounded but still powerful and vengeful.

The New Jersey Education Association, the state’s largest teachers union, was confident enough of its power over state government to ignore this rule with its viciously personal multimillion-dollar campaign to unseat Senate President Steven Sweeney in last week’s election.

The union itself spent more than $5 million supporting Sweeney’s opponent, who was a supporter of President Donald Trump, a campaigner for Gov. Chris Christie and an advocate for reduced school funding. Allied SuperPacs and other groups threw in millions more, probably bringing anti-Sweeney spending to $10 million.

Yet Sweeney won re-election by his largest margin ever. He immediately suggested the NJEA should change its leadership, which was quickly supported by two other leading Democrats, Senate Majority Leader Loretta Weinberg and Sen. Joseph Vitale, of Middlesex County.

The NJEA attack forced Democrats to spend NJEA-like money defending Sweeney, instead of supporting Democratic hopefuls in legislative races around the state.

The feud between the state’s Democrats and the NJEA grew out of New Jersey’s dire financial condition and its inability to fully fund politicians’ past pension and benefit promises. How it is resolved, even temporarily, will be the most consequential development in state government in the next four years.

The NJEA went after Sweeney because he failed to immediately advance a constitutional amendment to put paying teacher pensions ahead of all other state spending — such as on the sick and poor, police, seniors, even school funding. The union seemed more intent on sending a message to Democrats than actually defeating Sweeney, although that would have made the message even stronger.

The union’s leaders were pleased with the results, saying they showed the union would not back down from getting what it wants. NJEA officials are unlikely to step aside, let alone issue the apology that Democrats say is no longer enough. Their bullying of state government has paid off — their executive director makes $1.2 million a year, their five highest-paid officials average $764,000 a year, and the average N.J. teacher makes $70,000 a year for less than nine months of work (and pays about $900 of that in NJEA dues).

To the union, the money spent attacking Sweeney is just a tiny share of the cost of controlling New Jersey state government. A report coming out this month from the American Enterprise Institute puts total NJEA political spending from 1999 to 2015 at $725 million, or $43 million a year.

A similar episode of teachers punishing state legislators for not doing their bidding ended badly for New Jersey residents and taxpayers.

In the early 1990s, after Democrats failed to fulfill NJEA requests on pensions and state aid, the union backed Republicans and helped turn the Legislature from a Democratic to a GOP majority. Legislators responded in 1997 by protecting teacher pensions from any future reduction and in 2001 passing an outlandish 9 percent pension increase for existing and future retirees.

Today the state’s unfunded public-pension and retiree health liabilities are $253 billion, according to AEI, and annual costs are projected to rise to $11.3 billion a year by 2023 — or 27 percent of the state’s annual budget.

Legislators may not get far standing up to the NJEA even if they want to. The last time they produced a bipartisan plan to get state spending under control, Gov. Jon Corzine torpedoed it to maintain union support for his national ambitions. Another former Goldman Sachs executive, Gov.-elect Phil Murphy, bowed to the NJEA throughout his campaign. Maybe he aims for the national stage, too.

We hope the Democrats are serious about putting the public’s interests back where they belong, ahead of those of the teachers union. And we assume Republicans would join in that effort.

State government’s finances — the worst in the nation, according to the Mercatus Center — continue to deteriorate, and New Jersey keeps underperforming the national economy despite its advantageous location and talented workforce. The sooner legislators tackle this, the easier and better it will be for everyone.