Health care has been Exhibit A in that argument, a project he undertook at the cost of other ambitious efforts like curbing climate change or rewriting the tax code. While Mr. Obama will be remembered for bailing out the auto industry, winding down two wars and dispatching Osama bin Laden, health care was his play for history.

Not just Roosevelt and Johnson, but Harry S. Truman, Nixon and Mr. Clinton all tried and failed to move the country toward universal health coverage. Mr. Obama and the Democratic leaders on Capitol Hill succeeded, passing a bill that, through an expansion of private and government insurance, seeks to end the status of the United States as the world’s only rich country with millions of involuntarily uninsured citizens.

“Health care has been a squabble without end since the beginning of the progressive era, since Theodore Roosevelt,” Professor Brinkley said.

In addition to broadening the safety net, the law also seeks to alter a tax structure largely created by Reagan. To pay for the expanded insurance, Mr. Obama and Congress raised Medicare taxes on high-income households, as well as on medical companies.

“We’ve entered an era of zero-sum trade-offs, and Obama is trying to dramatize those trade-offs,” said Theda Skocpol, a professor of government at Harvard. “The health care law really symbolizes that; it’s a really redistributionist law.”

Had the justices struck down the law, they would have dealt Mr. Obama a crippling blow in the midst of a hard-fought campaign. Knocking down the central pillar of his legislative agenda would have called into question not only his judgment, but his very legitimacy, according to the presidential scholar Michael Beschloss.

Mr. Obama briefly found himself contemplating that fate just after 10 on Thursday morning as he watched live coverage of the ruling on a bank of television screens outside the Oval Office. Two cable TV networks, CNN and Fox News, erroneously reported that the court had struck down part of the law, before correcting themselves.