President Trump recently bashed a federal district court judge who temporarily halted a Trump administration policy to bar asylum seekers unless they appear at certain physical entry points on the southern border. Trump called Judge Jon S. Tigar an “Obama judge,” and even took shots at the 9th U.S. Circuit Court of Appeals — even though the temporary restraining order was not issued by that appellate court.

This rhetoric from the White House is not uncommon in modern times. What happened next was uncommon.

Apparently, calling Tigar an “Obama judge” bothered a federal judge. Not just any federal justice, but the chief justice of the United States, John Roberts, who made a rare public statement responding to the president's barbs.

“We do not have Obama judges or Trump judges, Bush judges or Clinton judges,” the chief justice told the Associated Press. “What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them.” He added “the independent judiciary is something we should all be thankful for.”

This is highly unusual. Federal judges do not ordinarily issue public comments like these. Unlike the president, rules of ethics severely restrict what judges can say openly.

The Code of Conduct for federal judges prescribes ethical norms to preserve the actual — and apparent — integrity of the federal judiciary. Those rules require federal judges to avoid impropriety and the appearance of impropriety in all activities. Judges are to avoid “communications concerning a pending … matter that are made outside the presence of the parties…” A judge “should not make public comment on the merits of a matter pending … in any court.” “Pending” matters include those that have been resolved but remain pending on appeal. Both federal law and the judicial code mandate that a United States judge “shall disqualify himself in any proceeding in which his impartiality might reasonably be questioned.”

This is why judges so rarely give interviews to the press. Gratuitous comments risk giving the impression that judges have personal involvement in the subject matter. In fact, any press interview could support accusations that a judge is generally influenced in his or her decisions by whether or not the judge will receive favorable media attention.

That’s why it’s such a significant event for any federal judge — let alone the chief justice — to make any public comment on any matter of public concern. It’s also why Justice Roberts’ comment was so carefully crafted. Paradoxically perhaps, the chief justice risked running afoul of the rules designed to preserve the appearance of judicial impartiality — in order to defend the judiciary’s impartiality.

The chief justice, like most federal judges, is a skilled wordsmith. He knew public comment would invite public criticism, so he crafted a public comment that, once boiled down, does little more than echo the canons of judicial impartiality. In doing so, the chief justice linguistically tiptoed through the minefield of judicial ethics in order to publicly defend his judicial colleagues.

Whether Roberts’ statement is completely true is another matter.

Syllogistically speaking, all humans are susceptible to bias. Judges are humans. Judges are therefore susceptible to bias.

Justice Roberts is correct that an “Obama Judge” or a “Bush Judge” is not a sworn agent of the president or the party that appointed him or her. The judicial oath is not a loyalty oath. On the other hand, everyone knows that judges are carefully chosen and appointed based on their judicial philosophy. The idea is that judges aren’t controlled by the appointing president or political party; they just happen to passionately agree with them on the issues. That’s why they were appointed in the first place.

Danny Cevallos is an MSNBC legal analyst. Follow @CevallosLaw on Twitter.