Updated

WASHINGTON -- A Senate panel on Tuesday backed Gen. David Petraeus to lead U.S. and NATO forces in Afghanistan even as he warned that that the U.S. will "need to provide assistance for a long time to come."

The Senate Armed Services Committee voted to confirm Petraeus to replace the ousted Gen. Stanley McChrystal. A full Senate confirmation is expected Wednesday.

At Tuesday's hearing, Petraeus noted that President Obama's reminder in recent days that July 2011 will mark the beginning of a process to withdraw troops -- not the date when the U.S. heads for the exit doors and turn out the lights.

At the G-20 summit last weekend, world leaders agreed that it will take a number of years before Afghan forces can assume most security tasks on their own.

"The commitment to Afghanistan is necessarily, therefore, an enduring one, and neither the Taliban nor our Afghan and Pakistani partners should doubt that," Petraeus said Tuesday.

Republicans and Democrats sparred over the wisdom of the July 2011 deadline to begin bringing forces home. Arizona Sen. John McCain, the top Republican on the committee, said the date was based on outdated assumptions about the war's progress.

"If the president would say that success in Afghanistan is our only withdrawal plan -- whether we reach it before July 2011, or afterward -- he would make the war more winnable and hasten the day when our troops can come home with honor, which is what we all want," said McCain.

Committee Chairman Sen. Carl Levin, D-Mich., said the 2011 date "imparts a necessary sense of urgency to Afghan leaders about the need to take on principal responsibility for their country's security."

Republicans say they want assurances that troops will only leave next year if security has improved. Obama has said troops will begin to leave, but the pace and size of the withdrawal will depend upon conditions.

Sen. Lindsey Graham, a Republican, sharply questioned Petraeus about whether he agreed with suggestions by Vice President Joe Biden that the pullout would not be based on conditions. According to reports, Biden has said that large number of troops will start pulling out of Afghanistan in July 2011, adding "you can bet on it."

Petraeus, who is hosting Biden for dinner Tuesday night at his headquarters in Florida, said that he was only aware of Biden having expressed support for the president's policy.

The answer didn't seem to satisfy an animated Graham.

"Somebody needs to get it straight without doubt what the hell we're going to do in Afghanistan," Graham said.

Petraeus also promised to "look very hard" at the rules of engagement governing troops in Afghanistan, if confirmed as the war's next top commander.

McChrystal was criticized by some for putting too many limits on firepower to protect the lives of civilians.

Petraeus said he sees it as a "moral imperative to bring all assets to bear" to protect U.S. and Afghan troops. He said "those on the ground must have all the support they need when they are in a tough situation."

That suggests some tweaks to the restrictive rules may be in the offing. Petraeus also endorsed the overall war strategy that prizes protecting people over attacking the enemy.

It's possible Petraeus could be confirmed as early as Tuesday because Congress is already intimately familiar with Petraeus and his record, according to a Senate GOP leadership aide.

Two years ago, he was promoted to head Central Command, a job that overseas all Middle East military operations, and from 2007 to late 2008 he served as the commanding general of Multinational Forces in Iraq.

He's famously credited for executing a successful counterinsurgency campaign and reversing the tide of the war there.

Shortly before McChrystal resigned his post, he described the U.S. offensive in Marjah, considered a model for future conflicts in southern Afghanistan, as a "bleeding ulcer." He also recently announced that an upcoming offensive in Kandahar had to be delayed because it was lacking the necessary support from local leadership. These pieces of negative news came at the same time the Pentagon moves closer to completing a 30,000 troop build-up in the region.

The Associated Press contributed to this report.