The most impressive quality of General David Petraeus, who stood down yesterday as the US military commander in Iraq, has been his modesty about his own success. While the outgoing President, George Bush, and his would-be Republican successor, John McCain, have embraced Gen Petraeus almost as a saviour (which indeed, politically, he has been to them), he himself has always refused to declare victory in Iraq, speaking instead of the "long struggle" that still faces the country if it is to achieve peace. "Our enemies," declared the US Secretary of State, Robert Gates, at the hand-over ceremony in Baghdad yesterday, "took a fearsome beating they will not soonforget." The hyperbole was soon punctured by General Petraeus's successor, Raymond Odierno, who argued that the "security gains" of the last year were "fragile and reversible".
That is no more than the truth. General Petraeus's achievements since he took command 18 months ago are considerable. A thinking general, he brought his expertise in counter-insurgency and substantial additional troops to bear in a sustained campaign to settle the violent environs of Baghdad and surrounding provinces, the so-called "surge" with which his name is now synonymous. But he has also been aided by his timing. By early last year, the storm of inter-communal violence in northern Iraq was already abating, as the various groups, including Shia, Kurds and Sunni, had largely fulfilled their aims of cleansing their respective areas of each other.
At the same time, Sunni tribal leaders were turning against al-Qa'ida and its campaign of civilian bombing and were ready to come to terms with the US occupiers, the better to arm themselves against their enemies within the country, just as the Shia militias were reaching the same conclusion. Iraq is more secure than it was, but 22 people died this week in a suicide bombing in Diyala province, and no one, least of all the US generals, is confident that it is a real peace that will survive US withdrawal. For the White House, the reduction in the killing rate is cause enough for acclamation after five long years of mayhem, partly caused by the US presence. For Iraqis, the time for celebration is still a long way hence.
The key question for the US administration, and for Gen Petraeus as he moves up to take command of the whole Middle East region, is whether the lessons of the surge can be applied to Afghanistan. Mr Bush clearly hopes so as he prepares to transfer more than half the 8,000 troops being withdrawn from Iraq this winter to reinforce US forces to the east. That is still only a small proportion of the 40,000 to 60,000 extra troops that US commanders say are needed if they are to win the battle against the Taliban.
Geographically, politically and militarily, Afghanistan presents a quite different challenge from Iraq. It is mountainous, with fewer urban centres. The Taliban have bases across the border in Pakistan where they can retreat and regroup. They are skilled guerrilla fighters who know the terrain and have considerable local support. Western forces have reduced their prospects of local co-operation by trying to root out opium, the major crop of the disaffected provinces. Added to that is a split in command between Nato forces operating under one set of coalition rules and US forces fighting under their own command.
Granted his many skills, General Petraeus had luck and circumstances on his side in Iraq. In Afghanistan, he will need more than his share of both if he is to succeed in a fight that has bested countless intruders before him.