Mr. Garre said the two newest justices are a study in contrasts. “Both have shown themselves to be confident and happy to go their own ways, even when it means joining the more liberal justices,” he said. “But Justice Gorsuch is more frequently on the right end of the court, and Justice Kavanaugh, so far at least, has gravitated more toward the center.”

Even before the stormy end of the term, the court had not always succeeded in staying out of the spotlight. In an extraordinary exchange in November, for instance, Chief Justice Roberts tangled with Mr. Trump, who had criticized an asylum ruling by saying it had been issued by an “Obama judge.”

The chief justice responded that “we do not have Obama judges or Trump judges, Bush judges or Clinton judges” but only “an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them.”

Richard J. Lazarus, a law professor at Harvard, said the court helped prove the chief justice right with its unpredictable voting, singling out its three most junior members.

“Although the large number of closely divided votes was inconsistent with the chief justice’s stated preference for unanimity, the shifting membership of those in the majority and dissent was very much in keeping with the chief’s admonition that there are not Bush, Obama or Trump judges and justices,” he said. “There was a striking number of cases in which the votes of individual justices, especially Kagan, Gorsuch and Kavanaugh, defied such ready political labels.”

The chief justice joined the court’s four liberal members — Justices Kagan, Breyer, Ruth Bader Ginsburg and Sonia Sotomayor — to form a majority in 5-to-4 decisions just once, in part of the census case. Justice Gorsuch voted with the liberal bloc in such cases four times. Justices Kavanaugh and Thomas each voted with that bloc once.

“The justices also seemed happy to celebrate such voting behavior,” Professor Lazarus said. “In many of those cases, the senior justice in the majority rewarded the justice who defied expectations by assigning them the job of writing the opinion for the court, including in big cases that a junior justice would otherwise be unlikely to get.”