WASHINGTON - President Obama had not even taken office before supporters were etching his likeness onto Mount Rushmore as another Abraham Lincoln or the second coming of Franklin D. Roosevelt.
Yet what if they got the wrong predecessor? What if Mr. Obama is fated to be another Lyndon B. Johnson instead?
To be sure, such historical analogies are overly simplistic and fatally flawed, if only because each presidency is distinct in its own way. But the L.B.J. model - a president who aspired to reshape America at home while fighting a losing war abroad - is one that haunts Mr. Obama's White House as it seeks to salvage Afghanistan while enacting an expansive domestic program.
In this summer of discontent for Mr. Obama, as the heady early days give way to the grinding battle for elusive goals, he looks ahead to an uncertain future not only for his legislative agenda but for what has indisputably become his war. Last week's elections in Afghanistan played out at the same time as the debate over health care heated up in Washington, producing one of those split-screen moments that could not help but remind some of Mr. Johnson's struggles to build a Great Society while fighting in Vietnam.
"The analogy of Lyndon Johnson suggests itself very profoundly," said David M. Kennedy, the Stanford University historian. Mr. Obama, he said, must avoid letting Afghanistan shadow his presidency as Vietnam did Mr. Johnson's. "He needs to worry about the outcome of that intervention and policy and how it could spill over into everything else he wants to accomplish."
By several accounts, that risk weighs on Mr. Obama these days. Mr. Kennedy was among a group of historians who had dinner with Mr. Obama at the White House earlier this summer where the president expressed concern that Afghanistan could yet hijack his presidency. Although Mr. Kennedy said he could not discuss the off-the-record conversation, others in the room said Mr. Obama acknowledged the L.B.J. risk.
"He said he has a problem," said one person who attended that dinner at the end of June, insisting on anonymity to share private discussions. "This is not just something he can turn his back on and walk away from. But it's an issue he understands could be a danger to his administration."
Another person there was Robert Caro, the L.B.J. biographer who was struck that Mr. Johnson made some of his most fateful decisions about Vietnam in the same dining room. "All I could think of when I was sitting there and this subject came up was the setting," he said. "You had such an awareness of how things can go wrong."
Without quoting what the president said, Mr. Caro said it was clear Mr. Obama understood that precedent. "Any president with a grasp of history - and it seems to me President Obama has a deep understanding of history - would have to be very aware of what happened in another war to derail a great domestic agenda," he said.
Afghanistan, of course, is not exactly Vietnam. At its peak, the United States had about 500,000 troops in Vietnam, compared with about 68,000 now set for Afghanistan, and most of those fighting in the 1960s were draftees as opposed to volunteer soldiers. Vietnam, therefore, reached deeper into American society, touching more homes and involving more unwilling participants. But the politics of the two seem to evoke comparisons.
Just as Mr. Johnson believed he had no choice but to fight in Vietnam to contain communism, Mr. Obama last week portrayed Afghanistan as the bulwark against international terrorism. "This is not a war of choice," he told the Veterans of Foreign Wars at their convention in Phoenix. "This is a war of necessity. Those who attacked America on 9/11 are plotting to do so again. If left unchecked, the Taliban insurgency will mean an even larger safe haven from which Al Qaeda would plot to kill more Americans."
But while many Americans once shared that view, polls suggest that conviction is fading nearly eight years into the war. The share of Americans who said the war in Afghanistan was worth fighting slipped below 50 percent in a survey released last week by The Washington Post and ABC News. A July poll by the New York Times and CBS News showed that 57 percent of Americans think things are going badly for the United States in Afghanistan, compared with 33 percent who think they are going well.
That growing disenchantment in the countryside is increasingly mirrored in Washington, where liberals in Congress are speaking out more vocally against the Afghan war and newspapers are filled with more columns questioning America's involvement. The cover of the latest Economist is headlined "Afghanistan: The Growing Threat of Failure."
Richard N. Haass, a former Bush administration official turned critic, wrote in The New York Times last week that what he once considered a war of necessity has become a war of choice. While he still supports it, he argued that there are now alternatives to a large-scale troop presence, like drone attacks on suspected terrorists, more development aid and expanded training of Afghan police and soldiers.
His former boss, George W. Bush, learned first-hand how political capital can slip away when an overseas war loses popular backing. With Iraq in flames, Mr. Bush found little support for his second-term domestic agenda of overhauling Social Security and liberalizing immigration laws. L.B.J. managed to create Medicare and enact landmark civil rights legislation but some historians have argued that the Great Society ultimately stalled because of Vietnam.
Mr. Obama has launched a new strategy intended to turn Afghanistan around, sending an additional 21,000 troops, installing a new commander, promising more civilian reconstruction help, shifting to more protection of the population and building up Afghan security forces. It is a strategy that some who study Afghanistan believe could make a difference.
But even some who agree worry that time is running out at home, particularly if the strategy does not produce results quickly. Success is so hard to imagine that Richard Holbrooke, Mr. Obama's special representative for Afghanistan, this month came up with this definition: "We'll know it when we see it."
The consequences of failure go beyond just Afghanistan. Next door is its volatile neighbor Pakistan, armed with nuclear weapons and already seething with radical anti-American elements.
"It could all go belly up and we could run out of public support," said Ronald E. Neumann, a former ambassador to Afghanistan and now president of the American Academy of Diplomacy. "The immediate danger is we don't explain to Americans how long things take. I certainly get questions like, ‘Is the new strategy turning things around? Is the civilian surge working?' We're not going to even get all of those people on the ground for months."
Others are not so sure that the new strategy will make a difference regardless of how much time it is given. No matter who is eventually declared the winner of last week's election in Afghanistan, the government there remains so plagued by corruption and inefficiency that it has limited legitimacy with the Afghan public. Just as America was frustrated with successive South Vietnamese governments, it has grown sour on Afghanistan's leaders with little obvious recourse.
Lt. Col. Douglas A. Ollivant, a retired Army officer who worked on Iraq on the National Security Council staff first for Mr. Bush and then for Mr. Obama, said Afghanistan may be "several orders of magnitude" harder. It has none of the infrastructure, education and natural resources of Iraq, he noted, nor is the political leadership as aligned in its goals with those of America's leadership.
"We're in a place where we don't have good options and that's what everyone is struggling with," Colonel Ollivant said. "Sticking it out seems to be a 10-year project and I'm not sure we have the political capital and financial capital to do that. Yet withdrawing, the cost of that seems awfully high as well. So we have the wolf by the ear."
And as L.B.J. discovered, the wolf has sharp teeth.