Correction: An earlier version of this story wrongly reported that Rep. Louie Gohmert (R-Tex.) discussed removing Roberts from the court. Gohmert discussed impeachment of Justice Elena Kagan.This version has been corrected.

When he was up for confirmation to the Supreme Court, John G. Roberts Jr. famously compared his job to an umpire in baseball, making sure that everybody plays by the rules.

“But it is a limited role,” Roberts added. “Nobody ever went to a ballgame to see the umpire.”

Until now, perhaps. The umpire took center stage Thursday as the Republican chief justice who upheld President Obama’s health-care law, delighting liberals who have long despised him and enraging conservatives who considered him one of their own.

The decision stunned legal observers on both sides and made Roberts the focus of heated invective from conservative activists and some Republican members of Congress, who derided him as a “traitor.”

But many of those familiar with Roberts’s thinking say the calibrated decision is fully in keeping with the outlook of a studious Catholic schoolboy who made his way to be first in his class at Harvard University — conservative in his views but also reverent toward institutions.

“It underscores that the chief basically does what he thinks is the right interpretation of the law and not what is necessarily popular or needed to curry favor,” said Richard Lazarus, a Harvard law professor who is close to Roberts. “He takes on both sides and steers his own path here and also steers a path for the court. He is very much in control.”

Roberts is nothing if not self-confident, according to many who have known him over the years, a personable and meticulous persuader who spent much of his career in the heights of the Washington political and legal establishment. By providing the pivotal vote in approving “Obamacare,” he did what many considered impossible — and exhibited a command of the court that has eluded many of his predecessors.

Roberts may have sided with liberals to save the signature domestic achievement of Obama’s presidency, but he also gave conservatives important legal beachheads that could pay off down the road. He abandoned his perch as one of the court’s consistent conservatives to play peacemaker between liberals ready to uphold the law in full and conservatives who wanted to pull the plug.

And he did it all without the help of Justice Anthony M. Kennedy, who most often plays the tie-
breaker role that Roberts assumed Thursday.

“There’s no question this was a moment of truth for John Roberts,” said Jeffrey Rosen, a law professor and Supreme Court expert at George Washington University. “He had to decide what kind of court he wanted to preside over.”

Roberts’s controlling opinion contained two main facets. He sided with conservatives in finding that the government could not, under the Constitution’s commerce cause, require most Americans to buy insurance. And he placed limits on what the government could demand of states in expanding Medicaid coverage.

But on a crucial point, Roberts sided with the court’s liberal wing in finding that the insurance mandate is constitutional as a tax.

“If you told people that there were four solid votes to strike down the whole thing, I think most people . . . would have been surprised to find that among the four would have been Justice Kennedy and not Chief Justice Roberts,” said Paul Clement, who represented a group of 26 states that challenged the health-care law.

The commentary from the right was brutal. Activist Brent Bozell called Roberts “a traitor to his philosophy” who “is forever stained in the eyes of conservatives.” Richard Viguerie of called the ruling a “21st century Dred Scott decision,” referring to the court’s 1857 finding that slaves had no rights.

Sen. David Vitter (R-La.) said, “It’s an extremely disappointing ruling, particularly with Roberts so amazingly rewriting the law in order to uphold it.”

However, the ruling was praised by many regular critics of Roberts, including Obama, who voted against Roberts’s confirmation while he was a U.S. senator and has clashed with him over rulings on corporate political spending and other issues while president. Many Democrats had argued that a partisan ruling against Obama’s health-care legislation would have irrevocably damaged Roberts’s, and the court’s, credibility.

“The court stepped back from the brink,” said Walter Dellinger, who was a deputy attorney general under Bill Clinton.

The son of a Bethlehem Steel executive, Roberts, 57, grew up in a prosperous home in northwestern Indiana near Lake Michigan and excelled academically and athletically at an elite, all-boys Catholic school. In one early test of his authority, Roberts served as the school’s enforcer of a strict dress code in class and the dining hall.

He went on to Harvard, where the socially conservative Midwesterner excelled but also bristled at many of his peers’ liberal views on abortion rights, racial preferences and other political topics of the day. He clerked for Chief Justice William H. Rehnquist and became a legal counsel in the Reagan administration, touching on some of the most polarizing issues of the 1980s, including school prayer and women’s rights in the workplace.

Roberts said during his 2005 confirmation hearing that he was “not an idealogue” and that he decided cases on pragmatic grounds: “I do not have an overarching judicial philosophy that I bring to every case. I tend to look at the cases from the bottom up rather than the top down.’’

A number of legal observers compared Roberts’s threading-the-needle approach Thursday to the strategy used by one of his judicial heroes, Chief Justice John Marshall.

In the landmark 1803 case, Marbury v. Madison, Marshall established the court’s power of judicial review, which persists to this day. But the decision itself was a legal pretzel, concluding that Thomas Jefferson’s administration had acted illegally but also that the court lacked jurisdiction.

In other words, the decision set the stage for two centuries of jurisprudence while avoiding an immediate political conflict with a sitting president. Bradley Joondeph, a Santa Clara University law professor who clerked for former justice Sandra Day O’Connor, said Roberts avoided a similar conflict with Obama over health care while establishing conservative limits on federal power.

“All told, it was a stroke of judicial genius,” Joondeph wrote on his blog. “A Marbury for our time.”

Robert Barnes, Adam Bernstein and Alice Crites contributed to this report.