Media playback is unsupported on your device Media caption President Obama said US troops would adopt a "fundamentally different" mission

US troops in Afghanistan will end "most" combat operations this spring, US President Barack Obama and Afghan counterpart Hamid Karzai have agreed.

American forces are expected to switch to a support role, slightly earlier than originally scheduled, as Afghan troops take the security lead.

The two leaders also backed the holding of talks between the Afghan government and Taliban leaders in Doha, Qatar.

Most of the 66,000 US troops in Afghanistan are due to leave in 2014.

"Starting this spring, our troops will have a different mission - training, advising, assisting Afghan forces," Mr Obama said in remarks at the White House on Friday, as Mr Karzai stood alongside.

Analysis Both leaders gave the impression that they have secured something tangible from their latest encounter. President Obama clearly feels he'll be able to accelerate the withdrawal of American forces in the coming months. For his part, President Karzai has secured the withdrawal of coalition forces from villages and the rapid handing over of prisons and detainees to his authority. This, he says, will make it easier to convince his own people that any American troops who remain after the end of the Nato-led mission in 2014 should be granted immunity from Afghan prosecution. It's an important indication the two sides are thinking ahead to a bilateral security agreement beyond 2014. But when President Karzai side-stepped the question of the size of America's long term presence (saying, rather implausibly, that "numbers are not going to make a difference"), he avoided the question that's been debated all over Washington this week.

"It will be a historic moment and another step toward full Afghan sovereignty."

The presidents also agreed that the US would hand over custody of prisoners to the Afghan government, a step Mr Karzai said was critical for his country's sovereignty.

The transition of US troops to a support role by this spring would be several months earlier than the mid-2013 deadline agreed at a Nato summit in Chicago last year.

Mr Obama said American forces could remain in Afghanistan in that support role beyond 2014.

But this would only be at the invitation of the Afghan government and under an agreement guaranteeing US troops immunity from Afghan law.

Mr Karzai said he was "very happy" to hear that Afghan forces would take over responsibility for providing security by this spring.

"The international forces, the American forces, will be no longer present in the villages, that it will be the task of the Afghan forces to provide for the Afghan people in security and protection," the Afghan leader said.

Mr Obama reiterated the US goal of destroying the remnants of al-Qaeda, and said the US had come close to achieving that.

Mr Karzai and Mr Obama committed to crafting a bilateral security agreement as soon as possible.

Media playback is unsupported on your device Media caption Watch Afghan army recruits learning how to ambush the enemy

US commanders have suggested leaving between 6,000 and 15,000 troops in Afghanistan to pursue insurgents and train Afghan security forces.

Mr Obama said on Friday that he would review recommendations from US military commanders before making a decision, as he reaffirmed that the US sought no permanent bases in Afghanistan.

In a joint statement following their meeting, Mr Obama and Mr Karzai said the training and progress of Afghan security forces had exceeded expectations.

They now lead about 80% of operations and by February are expected to have a lead in securing 90% of the Afghan population, the statement said.

Also on Friday, Mr Karzai confirmed he would step down from the presidency, as expected, at the end of his term in 2014.

"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."