Speaking at the White House Friday following his meeting with Afghan President Hamid Karzai, Obama said U.S. troops "will continue to fight alongside Afghans, when needed."
"But let me say it as plainly as I can: Starting this spring, our troops will have a different mission -- training, advising, assisting Afghan forces," he said.
Obama said that milestone would be "another step toward full Afghan sovereignty."
"And by the end of next year, 2014, the transition will be complete -- Afghans will have full responsibility for their security, and this war will come to a responsible end."
Karzai said he and Obama agreed on "the complete return of detention centers and detainees to Afghan sovereignty and that this will be implemented soon after my return to Afghanistan."
He said the White House meeting also produced an agreement to include Taliban officials to engage in direct peace talks with Afghan and Pakistani representatives, "where we'll be trying our best, together with the United States and our other allies, to return peace and stability to Afghanistan as soon as possible."
Before the news conference, the White House issued a statement saying the two leaders "discussed a strategic vision for a secure, stable and prosperous Afghanistan and reaffirmed the U.S.-Afghanistan Enduring Strategic Partnership Agreement signed in May 2012."
Obama and Karzai reviewed security and economic operations as well as preparations for what the White House called "free, fair, inclusive, and democratic elections in 2014."
The discussions also covered threats in the region and U.S. support for "long-term economic and social development" in Afghanistan.
The White House statement said Afghan National Security Forces have exceeded expectations on assuming lead combat operation responsibility, and currently lead about 80 percent of operations. Afghan troops are expected to increase the number to 90 percent in February and the International Security Assistance Force mission is expected to shift from combat to support by mid-2013.
"At the time of the milestone, most unilateral U.S. combat operations should end, with U.S. forces pulling back their patrols from Afghan villages," the White House said.
The White House meeting came one day after Karzai met with U.S. Defense Secretary Leon Panetta, who said Afghanistan is almost able to secure itself.
"After a long and difficult past, we finally are, I believe, at the last chapter of establishing a sovereign Afghanistan that can govern and secure itself for the future," Panetta told a news conference with Karzai at the Pentagon after the two met.
"We've come a long way toward a shared goal of establishing a nation that you and we can be proud of, one that never again becomes a safe haven for terrorism," Panetta said.
Karzai, by contrast, said his Islamic republic -- which borders Pakistan and Iran among other countries and still faces attacks by the Taliban insurgency -- clearly needs U.S. help.
The New York Times reported Friday the two leaders appeared far apart on how many U.S. troops would stay in Afghanistan after 2014.
Karzai appears to want as many as 15,000 troops to advise Afghan security forces in their fight against the Taliban and carry out raids against al-Qaida, the Times said.
Ben Rhodes, the White House deputy national security adviser for strategic communications, said Tuesday the administration was mulling a much smaller number -- possibly even withdrawing troops entirely in 2014, provided U.S. officials were convinced Afghanistan could stand on its own.
Karzai is also hoping the United States will supply the Afghan army with tanks, fighter planes and other military hardware, the Times said.
Karzai expressed his differing expectations from Washington's when at the news conference with Panetta Thursday.
"Afghanistan will, with the help that you provide, be able to provide security to its people and to protect its borders, so Afghanistan would not ever again be threatened by terrorists from across our borders," Karzai said.