When U.S. General David Petraeus was named supreme commander of NATO forces in Afghanistan one year ago, he had the reputation of something of a military miracle worker.
He was dubbed King David, the man who set unruly Iraq to rights, and lauded as the most influential general of his era, a warrior-scholar and the brilliant mind behind the American military's new gospel of counterinsurgency.
As he headed off to Kabul last July, he exuded confidence in public. "We are in this," he declared then, "to win."
In the end, Gen. Petraeus had just one year to work his magic on what has become an increasingly deadly, dirty and diffused conflict that he admits is far from won.
The general's war was fought with more resources than any NATO commander before him had and more than any commander after him is likely to get. But the insurgency he vowed to beat has outlasted him, for now, and Afghanistan has become a far deadlier place for Afghans and foreign soldiers alike.
Gen. Petraeus, who arrived with a nimbus of star power, goes out with success still eluding him.
Next week, he turns his command over to U.S. Marine Lieutenant General John Allen and heads off to his new civilian job as director of the Central Intelligence Agency.
"He's handing off Afghanistan better than what it was when he took control, but he didn't get everything he needed and he got outmanoeuvred politically," said Bill Roggio, a senior fellow at the Foundation for the Defense of Democracies.
"While he achieved some things, he wasn't able to achieve the wider goal of turning over security to the Afghan security forces from a position of strength," Mr. Roggio added. "Instead he's handing over from a position of weakness."
He leaves at a decisive juncture.
NATO country leaders have set the end of 2014 for withdrawing their forces and leaving Afghans in charge. Those local forces are largely untested and their leaders are still being trained. The first experiment in transition is only just beginning, involving seven areas of the country where Afghan forces are to take the lead in providing security.
Gen. Petraeus had 140,000 multinational troops under his command, the biggest and best-equipped fighting machine ever fielded in NATO's decade-long Afghanistan war. His successor will command a shrinking force, following President Barack Obama's decision to withdraw one-third of the American troops over the next 15 months. Other NATO countries announced they will soon follow suit. Canada's combat troops are completing their final withdrawal from Afghanistan this month.
In recent interviews, Gen. Petraeus has cited some gains. The number of insurgent attacks dipped in May and June compared with the same period last year, he said, an indication "they have been degraded somewhat."
Coalition commanders in southern Afghanistan, including the Canadians who just ended their combat mission, say the Taliban is having trouble resupplying its fighters. Special Forces operations and NATO air strikes, which increased dramatically under Gen. Petraeus, have apparently decimated the ranks of mid-level insurgent commanders.
His admirers in the Afghan government and the diplomatic corps here say he also achieved some success in the parallel NATO effort of trying to get the government to take charge of the country. He managed, by quiet force of personality, to corral Afghan security officials into sharing information with each other and pushed NATO commanders to start sharing strategy with the Afghans.
The general issued several tactical directives on use of force and air strikes during his tenure, the latest just last week, aimed at minimizing civilian deaths at the hands of coalition troops. A United Nations report released Thursday said the number of Afghan civilians killed by NATO forces dropped slightly in the first six months of this year compared to the same period last year.
But each incident, the latest involving six people killed in a night raid by NATO forces in Khost province, has eroded Afghan confidence in the general's, and NATO's, war.
His regular video-conference meetings with commanders were legendary for their cool focus on the number of suspected insurgents killed or captured each day.
"He sits in a chair for four hours and doesn't move," said a European diplomat who attended some of them. "Each person has seven minutes. Everything is timed to the minute. It's extraordinarily impressive, but it makes war everything. Everything becomes militarized."
Gen. Petraeus had more than double the number of Afghan and foreign soldiers under his command than were available to fight the Taliban just three years ago. They created a new dynamic that critics say made Afghanistan a more violent place and spread the insurgency.
More foreign soldiers on the ground meant more fighting, drew more insurgent attacks and created more targets for the insurgents' new weapon of choice, IEDs, or improvised explosive devices.
"It upped the overall ambient violence," said Nic Lee, director of the Afghan NGO Safety Office (ANSO), a security service and monitoring group that advices non-governmental organizations. "As it gets more kinetic, more people are going to get hurt."
Since June of 2009, when the United States started boosting its manpower on the ground, insurgent attacks have increased by 119 per cent, according to a soon-to-be published ANSO report. And Afghanistan became significantly more dangerous for aid workers, both Afghan and foreign.
"The contesting is what made it more dangerous," Mr. Lee said, "not the contestants."