Chief Justice John Roberts delivers for president who had opposed him

In this Jan. 27, 2010 file photo, President Barack Obama greets Chief Justice John Roberts before he delivered his State of the Union Address on Capitol Hill in Washington. Breaking with the court's other conservative justices, Roberts announced the judgment that allows the law to go forward with its aim of covering more than 30 million uninsured Americans. Roberts explained at length the court's view of the mandate as a valid exercise of Congress' authority to "lay and collect taxes." The administration estimates that roughly 4 million people will pay the penalty rather than buy insurance. (AP Photo/Charles Dharapak, file)

WASHINGTON (AP) — As a junior senator, Barack Obama voted against John Roberts' nomination to the Supreme Court, fearing he would favor the powerful over the weak.

Now it is Roberts who has saved the signature achievement of Obama's presidency, the health care overhaul, in a ruling that challenges critics' assertions that the chief justice is nothing more than a conservative ideologue.

Roberts had pledged at his 2005 confirmation hearing to act as a judicial umpire, calling balls and strikes without taking sides. On Thursday, he threw conservatives a curveball.

In a 5-4 ruling upholding the health care law, Roberts wrote for the majority that it's not the court's job to decide whether Obama's plan "embodies sound policies. That judgment is entrusted to the nation's elected leaders."

After all the speculation that the Republican-leaning court would strike down the law, Roberts' opinion startled even Paul Clement, the lawyer who had made the case against the law in oral arguments before the high court in March.

"If you told people that there were four solid votes to strike down the whole thing, you know, I think most people ... would have been surprised to find that among the four were Justice (Anthony) Kennedy and not the chief justice," Clement said.

The 57-year-old chief justice hasn't gotten this much attention since he flubbed the oath of office that he administered to Obama on Inauguration Day in 2009. His mangled wording of the inaugural oath prompted a presidential do-over the next day.

Thursday's ruling induced an instant role reversal.

Liberals sang Roberts' praises. Conservatives suddenly were less enamored. Roberts had been their darling since President George W. Bush picked the federal judge to replace Chief Justice William Rehnquist.

For a second time in the court's final week of its term, Roberts had aligned himself with the liberal justices. In a decision Monday, he had voted to invalidate parts of Arizona's crackdown on illegal immigrants.

Roberts "saved the day — and perhaps the court," in the health care ruling, said Harvard law professor Laurence Tribe, a constitutional scholar who once hired Obama as a research assistant and also had the chief justice as a student.

Democratic Rep. Brad Sherman of California chimed in: "Today I am proud to be a member of the Harvard Law School class of 1979, the class that included Chief Justice Roberts."

Sen. Charles Schumer, D-NY, said Roberts had "acted as the umpire he promised to be."

Republican lawmakers largely focused on their dismay with the ruling, steering clear of its author, although Sen. David Vitter, R-La., accused Roberts of "amazingly rewriting the law in order to uphold it."

Other critics let loose.

A National Review Online editorial, under the title "Roberts's Folly," said the chief justice and his colleagues had "done violence" to the Constitution. Hackers briefly changed Roberts' title on Wikipedia to "Chief Traitor of the United States" and labeled him a "coward." T-shirts declaring "Impeach John Roberts" were soon on sale.

As Republican presidential candidate Mitt Romney spoke out strongly against the ruling, his website lagged behind, still promising, "As president, Mitt will nominate judges in the mold of Chief Justice Roberts."

Once the shock at the ruling wore off, the questions about Roberts' motivations began.

Did he do it to salvage the court's image? Was he trying to preserve his legacy?

The court's reputation for impartiality took a major hit with the 5-4 ruling that awarded the presidency to Republican Bush over Democrat Al Gore in 2000. With the court's liberal and conservative justices often sharply divided in recent years, a CBS News-New York Times poll this month found that 76 percent of those surveyed thought the justices were at least sometimes influenced by their own political or personal opinions rather than the law.

The latest numbers from Gallup, which has tracked confidence in the court since 1973, are among the lowest the court has ever received.

William Galston, a former Clinton administration official, wrote that Roberts may have "had one eye focused on jurisprudence and another on the standing of the institution he heads."

But Richard Garnett, a University of Notre Dame law professor and former Supreme Court clerk to Rehnquist, rejected the idea that Roberts was out to please the public.

"Chief Justice Roberts is a guy who is trying hard to get the right answer even in hard cases that have political implications," Garnett said. Still, Garnett said the ruling might help to change public impressions, acknowledging that there was "a narrative that was being set up" painting the court in highly partisan terms.

Michael Dorf, a Cornell University law professor who clerked for Kennedy, said the ruling shouldn't be taken as evidence that Roberts has lost his conservative bent.

"There's no doubt that Roberts is a generally conservative justice," Dorf said. "What this case demonstrates is that he is not simply an ideologue and he was led where the arguments led him."

There was some speculation that Roberts had even thrown a bone to conservatives by going out of his way in the ruling to agree with their position that Congress lacked the power under the Constitution's commerce clause to put the mandate for health insurance in place.

In 2005, Obama, a former constitutional law professor, explained his vote against Roberts' confirmation by saying that the judge was qualified in temperament and scholarship for most of what comes before the high court, but not for those truly difficult cases where "the critical ingredient is supplied by what is in the judge's heart."

Rep. Tom Cole, R-Okla., predicted Roberts' stock with the president is a notch higher these days.

"I bet he gets an engraved Christmas card invitation to the White House," Cole said. "He's pretty popular right now, down there at 1600 Pennsylvania Avenue."