"very limited" role in the country after 2014 and insisted that Washington had achieved its prime goal of "decapitating" al-Qaeda.
The leaders met at a crucial moment in the final chapter of a long, bloody war, and as Obama balances the future security of Afghanistan with US combat fatigue and a desire to spend America's dwindling resources at home.
"Starting this spring, our troops will have a different mission -- training, advising, assisting Afghan forces. It will be a historic moment and another step toward full Afghan sovereignty," Obama told a joint news conference.
NATO plans previously called for foreign forces to transfer the lead in fighting the Taliban by the middle of this year. Obama was careful to stress, however, that US troops will still fight alongside Afghans.
Karzai added that from the spring, "the Afghan forces will be fully responsible for providing security and protection to the Afghan people."
"International forces, the American forces, will be no longer present in the villages... it will be the task of the Afghan forces to provide for the Afghan people in security and protection."
Obama, planning the withdrawal of most of the 66,000 US troops left in Afghanistan, said that after 2014, American forces would have a "very limited" mission in training Afghan forces and preventing a return of Al-Qaeda.
But he warned that Karzai, with whom he has had a somewhat testy relationship, would have to accept a security agreement, still under discussion, granting legal immunity to US troops who remain behind.
"It will not be possible for us to have any kind of US troop presence post-2014 without assurances that our men and women who are operating there are (not) in some way subject to the jurisdiction of another country."
Karzai announced progress on another sticking point between the sides, saying the leaders had agreed to a complete return of detention centers and terror suspects to Afghan control, starting soon after he returns home.
But he would not be drawn on the size of the foreign troop garrison he believes is necessary to support Afghan forces.
The White House has ordered the Pentagon to come up with plans for a smaller future Afghan presence than generals had expected, perhaps numbering 3,000, 6,000 or 9,000 US troops.
Obama's domestic political opponents, however, charge he is in a rush for the exit and warn that a minimal force could squander gains hard won in a war that has killed more than 3,000 coalition troops.
The White House even suggested this week that Obama would not rule out the possibility of leaving zero American boots on the ground.
This has compounded Afghan fears the country could be abandoned again by the international community -- as it was after the end of the Soviet occupation in 1989.
The power vacuum led to the rise of the Taliban, and a safe haven for Al-Qaeda to plot the September 11 attacks, which drew the United States into an Afghan war in 2001.
Obama said on Friday that despite the huge human and financial cost of the 12-year war, it was important to recognize that it had been waged in response to those attacks and had achieved its central goals.
"There is no doubt that the possibility of peace and prosperity in Afghanistan today is higher than before we went in," he said.
"Have we achieved everything that some might have imagined us achieving in the best of scenarios? Probably not. You know, there is a human enterprise and you fall short of the ideal."
Karzai pledged he would stand down at the end of his second term, after elections in 2014, amid some concerns he could try to cling to power.
"The greatest of my achievements eventually, seen by the Afghan people, will be a proper, well-organized, interference-free election in which the Afghan people can elect their next president," he said.
"And certainly I will be a retired president, and very happily a retired president," the two-term Afghan president vowed.
In a later address to students at Georgetown University, Karzai also painted an upbeat assessment of the future.
"Afghanistan is definitely moving in the right direction. 2014 will be a good year for us and the years after will be even better," said Karzai.
He vowed peace with the Taliban would not roll back hard-won gains made over the last decade, including women's rights, and said people would be able once more to visit his country as tourists.