By Adam Brookes
BBC News, Washington
Even as the Obama administration looks for ways to extricate the United States military from Iraq, it is preparing to deepen its involvement in the Afghan theatre.
Mr Gates said Americans should expect to be in Iraq for a long time
And when the Defence Secretary, Robert Gates, testified on Tuesday before the Senate Armed Services Committee, the depth and nature of the commitment to fighting on in Afghanistan began to become clear.
"President Obama has made it clear that the Afghanistan theatre should be our top overseas military priority," he said.
He repeated the view that there is no military solution to the Afghan conflict - but he said that "we've not had enough troops to provide a baseline level of security in some of the most dangerous areas". More troops are clearly on the way.
Two more combat brigades would be available to deploy in spring, and another would be ready by summer.
But it is support troops - engineers, medics, pilots and others - that are in short supply. And Mr Gates warned against sending combat troops into a situation where the military infrastructure was not in place to support them.
The US, he said, had agreed to increase the size of the Afghan army from 80,000 to 134,000. "I'm not sure even that number will be large enough," he said. Strong Afghan forces were "the exit ticket for all of us".
But Mr Gates seemed uncomfortably aware of the precedents for waging expeditionary warfare in Afghanistan. He said that the United States' objectives there should be "limited and realistic".
Mr Gates said the primary goal should be to "prevent Afghanistan being used as a base to attack us or our allies."
It appears that - one week into the new administration - US strategy has been shorn of its more lofty goals. Mr Gates seemed to have no interest in talk of democratisation or bringing prosperity to the Afghan people. Even so it would be a "long and difficult fight".
And he acknowledged that the civilian casualties brought about by US air strikes are doing the United States "enormous harm".
"If Afghans come to see us as part of their problem, not part of their solution, then we are lost," he said.
Mr Gates was given an easy ride by the senators, most of whom seemed simply relieved that he had agreed to stay on as defence secretary. His arm was in a sling following an operation to repair a damaged tendon, apparently sustained while operating a snowblower.
Watching him, one sensed his frustration, anger even, at the Pentagon bureaucracy and its unwieldy, inefficient procurement system.
He seemed unsentimental about the uniformed military, while conveying deep concern for the fate of the American soldier.
His approach to the vast, sprawling institution in his care seems to be a mixture of respect, candour and critique. It is a classy political act - and is perhaps why he enjoys such support in Washington.
But those parts of the hearing that focused on Iraq were intriguing.
Mr Gates described the Status of Force Agreement, or SOFA, signed by the US and Iraq last year as a "watershed, a firm indication that American military involvement in Iraq is winding down".
Under its terms, US combat troops will withdraw from Iraqi cities by June, and from Iraq altogether by the end of 2011.
So is that a viable map as to how the American withdrawal will go? Mr Gates was asked the question. Here is his answer:
"Well, I would just say that there is a - we are working on a range of options for the president that range from a withdrawal of essentially a completion of the work of the brigade combat teams and a transition to assist and advisory role beginning in 16 months and then at various intervals proceeding further forward from that. And we're drawing those out for him along with the risks attendant to each."
In other words, the plan is not settled upon yet, and Mr Gates and the generals are going to present President Obama with a set of possible timelines for withdrawal, each coupled with a discussion of what could go wrong.
And, in any case, US troops will remain in Iraq in various roles, even after the combat brigades are long gone.
Perhaps one can sense here unease in the military at Mr Obama's insistence on ending combat operations in 16 months.
Mr Gates said that Americans should expect to be in Iraq for a long time.
Clearly Mr Obama does not want Iraq to be his war, but it is not clear yet that he will avoid it.