Gen. David Petraeus on Tuesday appeared to adroitly navigate around the potential pitfalls of his nomination hearing to be commander of allied forces in the Afghanistan war. In particular, General Petraeus vowed to senators that he supports President Obama’s Afghan strategy, including its exit plan, while simultaneously reassuring them that the US commitment to the fight there “is an enduring one.”

Petraeus repeated that the July 2011 deadline for the beginning of troop withdrawals is flexible and that any such drawdown will occur only if it is warranted by conditions on the ground. The formulation seemed to satisfy most, though not all, members of the Senate Armed Services Committee. The chairman of the panel, Sen. Carl Levin (D) of Michigan, noted that it is foreordained that Petraeus will win confirmation to his new post.

“I’m allowed to assume you will be confirmed. You’re not, but I am,” Senator Levin told Petraeus at one point, drawing laughter from his fellow lawmakers.

IN PICTURES: Fighting continues in Afghanistan

That the hearing was occurring at all reflects extraordinary circumstances. Afghan commander Gen. Stanley McChrystal’s derogatory comments about civilian officials to Rolling Stone led to his resignation last week. Then Petraeus agreed to accept the position, though technically it is a demotion from his current job as commander of US Central Command, which covers all of the Middle East and Central Asia.

Petraeus is a popular figure on Capitol Hill, as lawmakers credit him with a major role in turning around the Iraq conflict. Many are looking to him to perform a similar miracle in Afghanistan, where the fight against the Taliban has proved long and hard.

Petraeus 'can win wars'

“General Petraeus has proved he can win wars,” said Sen. John McCain of Arizona, the panel’s ranking Republican.

Petraeus told senators that next July marks the beginning of a process under which withdrawals will be considered, and not a date at which the US will race for the exits. He implied that substantial US forces would remain in the country for the foreseeable future.

“It will be a number of years before the Afghans can truly handle their security on their own,” Petraeus told senators.

Pressed by Sen. Lindsey Graham (R) of South Carolina to reconcile his views with statements from Vice President Joe Biden that troops will be coming home next summer, Petraeus was able to recount a meeting at which Mr. Biden said he supported the existing policy. The general then let drop he was scheduled to have dinner with the vice president on Tuesday evening.

Petraeus similarly worked his personal contacts with Afghan President Hamid Karzai into the hearing, mentioning at several points a phone conversation with Mr. Karzai carried out in the car bringing Petraeus to the hearing.

“This is a test of wills,” said Petraeus. “The enemy must know we have the will to prevail.”

Recent months have seen tough fighting and rising casualties, and there is more fighting ahead, said the general. But he said that the Afghan army is making some progress

Some progress among Afghan forces

The number of allied trainers has increased, he said, meaning that the ratio of trainer to Afghan trainees has gone from 1 to 70, to 1 to 39. Some 85 percent of Afghan army units are now partnered with US or allied units in the field.

“Afghan forces are now in the lead in Kabul,” said Petraeus.

Senator Levin, however, noted that in a written response to committee questions Petraeus also said there are only about 7,200 Afghan army troops in Kandahar Province, a crucial area of the conflict.

Some US troops on the ground in Afghanistan have complained about the rules of engagement under General McChrystal. They felt these rules, designed to minimize Afghan civilian casualties, were too restrictive in regard to use of airpower and other support for units engaged in firefights.

Petraeus said he would review how the rules of engagement are being implemented throughout the force. He said it is possible some commanders are taking a “bureaucratic” approach when defining them.

“When [US troops] are in a tough spot, it is a moral imperative that we use all we have to get them out of it,” said Petraeus.

IN PICTURES: Fighting continues in Afghanistan

Related: