President Obama did acknowledge the success of the surge in Iraq and used some of its lessons to develop a plan in Afghanistan, the head of Central Command said Sunday.

Gen. David Petraeus, who is in charge of military operations throughout the Middle East and Central Asia -- regions containing Iraq and Afghanistan -- said the president asked him how troops worked to secure the population and achieve cooperation with various Iraqi factions, and held several lengthy sessions to review the principles that could be applied in Afghanistan.

During his presidential campaign, Obama frequently discussed how he strongly opposed the war in Iraq and the surge of 2007.

Petraeus said that while Obama "did, in fact" acknowledge the success of the surge, "we've spent a lot of time taking the rear view mirrors off the bus and avoiding re-litigating, if you will, you know, past battles and all the rest of this, and focusing to the future."

The top commander also told "Fox News Sunday" that while "certainly there are some similarities and the -- and the focus again on focusing on the security of the people is an important component of this. But we have to be very careful to recognize the enormous differences between Afghanistan and Iraq."

More On This...

To that end, the general, who opposed deadlines in Iraq, said he now sees benefits to setting a timeline for withdrawal from Afghanistan.

Recognizing the inherent contradictions of announcing a plan to begin a withdrawal of troops in July 2011 while also implementing a surge of 30,000 troops between now and May 2010, Petraeus said the strategy demonstrates both resolve and an urgency to get Afghanistan's military and police forces operational.

"There is undeniably some tension between" announcing a surge and a withdrawal, Petraeus said. "But ... this will be conditions-based, responsible and a transition starting, but not a race to the exits."

Separately, Defense Secretary Robert Gates said Americans should expect a significant U.S. military presence in Afghanistan for another two to four years.

Appearing Sunday on NBC's "Meet the Press," Gates noted that Afghan President Hamid Karzai talked in his inaugural address about taking over security control in all of Afghanistan in five years, so an initial troop withdrawal in Afghanistan in 2011 may involve only a small number of troops.

Gates says that just as in Iraq, the U.S. will turn over provinces to homegrown security forces, allowing the United States to bring the number of troops down steadily.

Gates also told CBS' "Face the Nation" that if the Taliban lays low until the troops begin withdrawing in 2011, the coalition forces will have made great progress in stabilizing Afghanistan. He also rejected any suggestion that setting a transition date for withdrawing U.S. forces in Afghanistan will embolden the Taliban.

The Associated Press contributed to this report.