Lately judges have struck down several big regulations from the Obama administration, putting at risk parts of its policy legacy. Some liberal commentators have reacted by blasting the judges as meddlesome activists and calling for more judicial deference to the president’s power to set national policy with the help of what are seen as expert federal agencies.

Bad idea, guys. If you’re worried about President-elect Donald Trump, this is exactly the wrong moment to reproach judges for standing up to executive-branch power grabs.

In November, a Texas federal judge moved to stop a Labor Department regulation that had sought to reclassify salary earners between $23,600 and $47,892 a year as hourly workers for whom employers would owe overtime and have to keep records of time worked.

Shortly before, another judge barred enforcement of a second controversial Labor Department regulation, requiring public disclosures from lawyers and other “persuaders” who advise management against unionization.

Those are just the latest in a string of courtroom losses for Obama regulators. The Equal Employment Opportunity Commission has met with especially poor fortunes, with judges routinely refusing to defer to its interpretations of discrimination law.

Opinions differ on the underlying merits of many of these issues. Like most employers I’ve talked to, I think the overtime rules were a bureaucratic nightmare and wouldn’t actually help middle-income workers. You may disagree and that’s your prerogative.

But courts ask somewhat different questions. Does the underlying 1938 Fair Labor Standards Act clearly call for this result? If not, is the agency making things up as it goes along? Has it followed procedures likely to ensure a strong factual basis and careful deliberation? How much deference should courts give its expertise?

When voters elected a Republican Congress, President Obama famously vowed to act by decree: “I’ve got a pen, and I’ve got a phone.” And: “We can’t wait.”

Agencies began to quick-march rules. Thus the Labor Department brushed off an outcry from the American Bar Association — often an Obama ally — that its “deeply flawed” persuader rule endangered lawyer-client confidentiality and would pressure attorneys to protect their own interests at the expense of clients’. On the overtime scheme, one of the most drastic changes in labor law in a half century, more than 145 charitable nonprofits signed a letter begging the department to allow more than a 60-day public comment period. It refused. And why not? It had made up its mind what it intended to do.

Harvard law professor Noah Feldman seems to like the overtime rule, as being “aimed to help lower-middle-class workers.” (Good intent and all that.) In a Nov. 30 Bloomberg View column, he blasted the federal jurist who struck down the rule, Judge Amos Mazzant III, as an “activist” for not giving the administration the “discretion” and “policy deference” it deserves.

But Feldman didn’t stop there. He declared Mazzant’s decision — handed down after the election, but in a case filed in September — as somehow “on board with Trump-style antiregulatory jurisprudence.” And he went an ugly step further, openly wondering “whether Mazzant sees an opportunity for judicial advancement with this anti-regulatory judgment.”

Feldman offered not one iota of evidence for the insinuation that Mazzant — an Obama appointee himself — was somehow trying to curry favor with the new administration. Apparently 2016 is the year when anyone gets to say anything about federal judges, whether Judge Gonzalo Curiel in the Trump University case or Judge Mazzant here.

It is in fact striking that many other court opinions besides this one invalidating Obama-era regulations, including many of the rulings against the EEOC, were handed down by judges appointed by Obama or other Democratic presidents.

That’s not some weird paradox. It’s one of the glories of our independent judiciary. Judges rule all the time against the partisan side that appointed them.

And we’ll be glad of that when the Trump executive orders and regulations begin to hit, and Republican-appointed federal judges are asked to restrain a Republican White House, as they have often done in the past.

We should be celebrating an energetic judiciary that shows a watchful spirit against the encroachments of presidential power.