For someone trying to demonstrate that the judiciary is not political, getting into a political fight with the president sure is a funny way to do it.

After President Trump called a judge who ruled against him an "Obama judge," Chief Justice John Roberts issued an extraordinary public rebuke of the president, declaring in statement "We do not have Obama judges or Trump judges, Bush judges or Clinton judges." Roberts was not only wrong to speak out, but also his claim that there are no Obama judges or Trump judges was wrong.

If we do not have Obama judges or Trump judges, then why did Senate Republicans block President Barack Obama's nomination of Merrick Garland to replace the late Justice Antonin Scalia in the final year of Obama's term? And why did Democrats filibuster Trump's nominee, Neil Gorsuch, to fill Scalia's seat?

Even Roberts's fellow justices know there is a difference. If there were no Obama judges or Trump judges, then why did Anthony Kennedy wait for Trump's election to announce his retirement? And why doesn't Justice Ruth Bader Ginsburg just retire now and let Trump nominate her replacement? Because they both want a president who would appoint a successor who shares their judicial philosophy. (And, lo and behold, Trump appointed a former Kennedy clerk, Brett Kavanaugh, to succeed him).

Roberts is correct that we should not have "Trump judges" or "Obama judges." It would be better for the country if every judge, regardless of which president nominated him or her, strictly interpreted our laws and the Constitution. But the reality is that not all do. While conservative presidents tend to nominate judges who exercise a philosophy of judicial restraint — follow our laws as written — liberal presidents tend to nominate judicial activists who legislate from the bench and shape the law to reach their preferred outcomes. The left believes in a "living Constitution," which can be interpreted to mean whatever they want it to mean without being formally amended.

Democratic presidents have been much more successful than Republicans in nominating Supreme Court judges who hew to their judicial philosophy.

And what is true of the Supreme Court applies even more to the appellate courts. Trump is right, the U.S. Court of Appeals for the 9th Circuit is a disgrace. This is the court that ruled that the phrase "under God" in the Pledge of Allegiance was unconstitutional, that the Second Amendment doesn't recognize an individual right to bear concealed arms and that bans on assisted suicide are unconstitutional.

This is why it is so important that Trump has nominated, and the Senate has confirmed, a record number of district and circuit court judges — and why liberals are aghast at the pace of Trump's judicial confirmations.

We do have an independent judiciary. Judges are not beholden to any president, including the one who appoints them. That is why it is so important for the chief justice stay above politics. Rolling around in the rhetorical mud with Trump is not just bad form; it also undermines the very judicial independence Roberts is seeking to uphold.

Follow Marc A. Thiessen on Twitter, @marcthiessen.