Chief Justice John Roberts speaks during the Bicentennial of Mississippi's Judiciary and Legal Profession Banquet in Jackson, Mississippi. Credit: Rogelio V. Solis | AP

Chief Justice John G. Roberts Jr. deserves credit for pushing back — judiciously — against President Donald Trump’s latest attack on the federal judiciary.

Trump had complained that “an Obama judge” in Northern California had ruled against the president’s attempt to restrict asylum applications. He ominously added: “I’ll tell you what, it’s not going to happen like this anymore.”

In a statement released by the Supreme Court, Roberts said: “We do not have Obama judges or Trump judges, Bush judges or Clinton judges. What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them.”

It was a point worth making, even though it wasn’t likely to have any influence on Trump. In fact, the president struck back right away on Twitter:

“Sorry Chief Justice John Roberts, but you do indeed have “Obama judges,” and they have a much different point of view than the people who are charged with the safety of our country. It would be great if the 9th Circuit was indeed an “independent judiciary,” but if it is why … …

” … ..are so many opposing view (on Border and Safety) cases filed there, and why are a vast number of those cases overturned. Please study the numbers, they are shocking. We need protection and security — these rulings are making our country unsafe! Very dangerous and unwise!”

So, good for the chief justice, but his intervention inspires a few thoughts:

I wonder how many people who will applaud Roberts for this statement think that the Republican Senate in 2016 “stole” a seat from Barack Obama by refusing to consider his nomination of Judge Merrick Garland to replace the late Antonin Scalia. Isn’t that just another way of saying that liberals were denied an “Obama judge”?

Maybe Roberts should also aim his criticism at journalists, who routinely identify federal judges in terms of the president who appointed them, even when it’s not relevant.

Roberts knows that his assertion that judges aren’t partisan requires a large asterisk. In some politically charged cases, judges appointed by Democratic presidents can be expected to rule differently from judges appointed by Republicans. But that doesn’t make them partisan hacks. Trump needs to be reminded of that, but so do some Democrats.

If Roberts is in a remonstrating mood, maybe he will quietly discourage his colleagues on the court from acting in ways that reinforce the “Obama judge/Trump judge” stereotype — such as attending events of ideologically defined groups such as the Federalist Society and the American Constitution Society.

Roberts’ defense of a so-called Obama judge is a reminder that, as a senator, Obama voted against Roberts’ confirmation. Obama said he voted “no” because Roberts had “far more often used his formidable skills on behalf of the strong in opposition to the weak.” The cynical view, of course, is that he didn’t want the political baggage of having voted for a “Bush judge.”

Of course, despite being dissed by Obama, Roberts voted twice to uphold provisions of the Affordable Care Act, Obama’s signature legislative accomplishment, against legal challenges. Does that make him an honorary “Obama judge”? Some Republicans think so.

Michael McGough is the Los Angeles Times’ senior editorial writer, based in Washington, D.C.