IN ALEXANDER HAMILTON’S memorable formulation, the federal judiciary is “the least dangerous branch.” Unlike Congress and the president, which make and execute the laws, respectively, the courts “have neither FORCE nor WILL, but merely judgment; and must ultimately depend upon the aid of the executive arm even for the efficacy of its judgments.” Hamilton assumed that offering judges life tenure would encourage them to augment their modest power with moral authority — the intangible combination of legal expertise, persuasive reasoning, impartiality, independence and solemnity, actual and perceived, that we call “legitimacy.”

For many Americans, the Supreme Court’s decision on President Obama’s health-care reform poses a keen test of legitimacy. In an atmosphere of intense partisanship, made more acute by a pending national election, can these five Republican-appointed justices and four Democratic-appointed ones pass judgment in a way that impresses most Americans as an act of law rather than politics? We have maintained that they can, or at least that the justices should enjoy a presumption of good faith. But the recent behavior of one member of the court, Justice Antonin Scalia, makes that presumption harder to sustain.

In dissenting from a court ruling that struck down all but one part of Arizona’s law on illegal immigrants, Justice Scalia strayed far from the case at hand to deliver animadversions on President Obama’s recent executive order barring the deportation of people who entered the country illegally as children. Based on nothing more than news reports, Justice Scalia opined that this policy would divert federal resources from immigration enforcement, thus creating “the specter” of a “Federal Government that does not want to enforce the immigration laws as written, and leaves the States’ borders unprotected against immigrants whom those laws would exclude.”

This gratuitous outburst, regarding a matter that might someday come before the court as a legal case, followed Justice Scalia’s performance during oral arguments on health care, which included a wisecrack about striking down the “Cornhusker Kickback” — even though that infamous dollop of Medicaid money for Nebraska, allegedly inserted in return for the vote of that state’s senator, was no longer in the statute. He sneered that asking the justices to read the entire 2,700-page Affordable Care Act would violate the Eighth Amendment prohibition against cruel and unusual punishment. He launched into a muddled riff on an old Jack Benny comedy routine that became so protracted and distracting that Chief Justice John G. Roberts Jr., amused at first, eventually had to declare, “That’s enough frivolity for a while.”

Justice Scalia is nothing if not intelligent; his unpredictable approach to certain issues, especially free speech and criminal law, mark him as a less-than-doctrinaire conservative. And surely even the court’s proceedings can use a dash of humor every now and then.

But his lapses of judicial temperament — bashing “a law-profession culture, that has largely signed on to the so-called homosexual agenda” in a written dissent, or offering views on this and that in sarcastic public speeches — detract from the dignity of his office. They endanger not only his jurisprudential legacy but the legitimacy of the high court.