President Trump shakes hands with Chief Justice John Roberts as Trump arrives to deliver his first address to a joint session of Congress, on Feb. 28, 2017. (Jim Lo Scalzo/AFP/Getty Images)

Late Monday, a U.S. district judge in San Francisco blocked the Trump administration from denying asylum to migrants who crossed the southern border illegally, saying the president violated a “clear command” from Congress to allow them to apply. Trump’s reaction was to add “Obama” judges, specifically those sitting on the 9th Circuit out West, to his list of those responsible for what he calls the nation’s “open borders.”

“This was an Obama judge,” the president said. “And I’ll tell you what, it’s not going to happen like this anymore. Everybody that wants to sue the United States, they file their case in — almost — they file their case in the 9th Circuit. And it means an automatic loss no matter what you do, no matter how good your case is.” He strung out the theme on Thanksgiving, demonizing the judges who, he tweeted, will be responsible for “bedlam, chaos, injury and death” for not letting law enforcement do their jobs.

His attack on Judge Jon S. Tigar, who issued the temporary order on asylum, was sufficient to arouse Supreme Court Chief Justice John G. Roberts Jr. “We do not have Obama judges or Trump judges, Bush judges or Clinton judges,” Roberts said in a statement. “What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them.”

As unusual as Roberts’s comments were, he could have said so much more, like maybe, you’ve got to be kidding, Mr. President, if you think your judicial problems are confined to “Obama” judges in a single circuit.

He could have noted that the number of rulings against his administration’s actions now stands somewhere in the range of about 40 to 50, according to a rough estimate by The Washington Post. Norman Siegel, writing at Law.com in January, counted 37 “major” losses, and that was in January, before numerous other rulings that thwarted Trump administration decisions.

And he could have observed that all of this is a bit of a surprise. All presidents lose cases. But a losing streak of this magnitude for a president is a new phenomenon.

Despite the endless decades of rhetoric about “judicial activism,” judges at the district court level are generally a timid lot when it comes to confronting presidents. Historically, they are inclined to do what former federal judge Nancy Gertner calls “duck, avoid and evade.”

“Now,” she wrote in the April issue of NYU Law Review, “I am not so certain. . . . Perhaps ‘judging in a time of Trump’ ” is different, she wrote. “It is one thing to ‘duck, avoid and evade’ when you believe that official actors are acting more or less within constitutional bounds. It is another to do so when you are concerned about real abuse of power.”

An abuse of power was what Tigar found: “Whatever the scope of the President’s authority,” he wrote, “he may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden.” Trump did not discuss Tigar’s actual findings.

The biggest defeats have included four decisions blocking the president’s travel ban before the Supreme Court finally upheld its third iteration; his attempt to rescind Deferred Action for Childhood Arrivals, blocked by at least four courts; and the proposed ban on transgender people in the military, stopped in its tracks by no fewer than four judges, with two of the rulings upheld by appeals courts. Judges in Chicago and Philadelphia, as well as California, temporarily stopped Trump’s “sanctuary cities” crackdown.

A total of five rulings, by judges in Oregon, New York and the District of Columbia, among other places, enjoined the administration from cutting off funds to teen pregnancy prevention programs that failed to preach abstinence to the satisfaction of the Department of Health and Human Services.

This doesn’t count environmental rulings, like the Nov. 8 one halting construction of the Keystone XL pipeline issued by a judge in Montana. Judge Brian Morris was indeed appointed by President Barack Obama, though he clerked for the most conservative chief justice in modern history, William H. Rehnquist.

Roberts could have noted that those defeats have come at the hands of judges appointed not just by Democratic presidents but by Republicans dating all the way back to Ronald Reagan.

It was U.S. District Court Judge Dana M. Sabraw, for example, a California jurist appointed by President George W. Bush, who ripped the administration repeatedly for its family separation debacle.

And how could Trump forget that it was his own appointee, Timothy J. Kelly of the U.S. District Court for the District of Columbia, who slapped down the effort to ban CNN’s Jim Acosta from the White House.

Many of these judges do indeed sit on the U.S. Court of Appeals for the 9th Circuit (which covers a vast swath of territory of nine states — California, Nevada, Arizona, Montana, Washington, Oregon, Hawaii, Alaska and Idaho — and Guam and Northern Marianas, and is a traditional target for conservatives).

But as noted, rulings thwarting Trump have also come from judges sitting in New York, Maryland, the District of Columbia, Pennsylvania, Illinois, Massachusetts, Virginia, Michigan and beyond.

While there’s no scientific way of comparing judicial rhetoric, Republican appointees outside the 9th Circuit have actually seemed more inclined than others to lecture the president about the Constitution.

One of the toughest dressings-down came from a decision blocking Trump’s “sanctuary cities” crackdown written by Judge Ilana Rovner, appointed by President George H.W. Bush to the U.S. Court of Appeals for the 7th Circuit, based in Chicago. In a decision joined by a Gerald Ford appointee and a Reagan appointee upholding a lower-court ruling by a Reagan appointee, she lit into the Trump administration for assuming powers to withhold money not granted to it by Congress to punish states and cities that didn’t go along with efforts to round up those in the country illegally.

Her message to Trump and then-Attorney General Jeff Sessions, translated, was basically, who do you think you are?

Our role in this case is not to assess the optimal immigration policies for our country. . . . The founders of our country well understood that the concentration of power threatens individual liberty and established a bulwark against such tyranny by creating a separation of powers among the branches of government. If the Executive Branch can determine policy, and then use the power of the purse to mandate compliance with that policy by the state and local governments, all without the authorization or even acquiescense of elected legislators, the check against tyranny is forsaken.

There was one possibly accurate observation in Trump’s comments: He said his losses sometimes seem “automatic.”

Based on the record, that’s not far from the truth.

But Roberts would never say that.