But even as Gates hinted at possible further troop cuts in Iraq next year, he said that a go-slow approach is justified by several worrisome circumstances, including slow progress on the political front.
"I worry that the great progress our troops and the Iraqis have made has the potential to override a measure of caution born of uncertainty," Gates told the House Armed Services Committee. "Our military commanders do not yet believe our gains are necessarily enduring - and they believe that there are still many challenges and the potential for reversals in the future."
Gates also warned that "we should expect to be involved in Iraq for many years to come, although in changing and increasingly limited ways."
Gates said that sectarian tensions still exist in Iraq, and have the potential to undo recent security progress.
The Pentagon chief was testifying one day after President George W. Bush announced that he has approved a plan to withdraw about 8,000 U.S. troops by February. Some troops will leave this fall, but the number of combat brigades in Iraq will remain at the current 15 until late January or early February.
Both Gates and Adm. Mike Mullen, chairman of the Joint Chiefs of Staff, described a new emphasis on Afghanistan, included a greater push to improved the Afghan security forces, and increased pressure on Pakistan to work with Kabul to quell insurgents crossing the border.
Mullen told the panel that while he is not convinced the coalition is winning in Afghanistan, "I am convinced we can."
Under the Pentagon plan approved by Mr. Bush, one Marine battalion will be sent to Afghanistan in November to replace two that are scheduled to leave. And an Army brigade will deploy to Afghanistan in January, increasing slightly the troop levels there in the coming months.
Rep. Ike Skelton, a Missouri Democrat who chairs the committee, pressed Gates and Mullen on whether the Pentagon is ready to change its repeated assertion that it does what it can in Afghanistan, and does what it must in Iraq - to reflect a new priority for the Afghan fight.
Gates responded that the Afghan fight is more complex, because there are more diverse enemies as well as a broader, more complex coalition fighting them.
"I would say we are reducing our commitments in Iraq and we are increasing our commitments in Afghanistan," he said.
Mullen, meanwhile, said it is critical that other federal agencies provide much needed additional civilian support in Afghanistan, including for provincial reconstruction teams. Defense leaders made similar arguments in the past for the teams in Iraq - urgently pressing for representatives from the Agriculture, Commerce and Justice departments to help with the reconstruction and economic rebuilding.
Those requests have often proved difficult to fill.