WASHINGTON: President Barack Obama on Tuesday said the United States was committed to long-term ties with Afghanistan but did not want to keep troops there longer than needed to disable al Qaeda and ensure a modicum of stability as foreign forces withdraw.

"President (Hamid) Karzai understands we are interested in a strategic partnership with the Afghan people and the Afghan government," Obama told reporters in a news conference.

"We are not interested in staying there any longer than is necessary to ensure that al Qaeda is not operating there and that there is sufficient stability that it doesn't end up being a free-for-all after ISAF has left," he said, referring to the NATO military force led by the United States.

Obama spoke as the White House seeks to put behind it the spasm of violence that erupted when U.S. soldiers burned copies of the Quran on a NATO military base last month - and the questions it has raised about U.S. strategy.

The outcry over the desecration of the Muslim holy book has underscored the challenges that remain in Afghanistan despite Western nations' plans to withdraw most of their troops by the end of 2014.

"Yes, the situation with the Quran burning concerns me," Obama said. "I think that it is an indication of the challenges in that environment and it's an indication that now is the time for us to transition."

NATO forces have begun to gradually put local police and soldiers in the lead for security. While the Afghan military is far larger and better equipped than it was, it will remain heavily reliant on outside help and funding for years to come.

Obama said he was confident his plan could be carried out. "But it's not going to be a smooth path," he said. "There are going to be bumps along the road just as there were in Iraq."