By John Simpson
World affairs editor, BBC News
Since the invasion of Iraq in 2003 I have spent almost a year of my life here, reporting on the conflict.
I have witnessed a disturbing amount of death and injury, and several of my friends have lost their lives. Others have become refugees and asylum-seekers.
An increase in US troop numbers has helped contain violence
It has lasted almost as long as World War II and cost almost as much.
Only one of its original aims, the overthrow of Saddam Hussein, has been achieved.
Of the other aims, one was unobtainable because Iraq had no weapons of mass destruction to be destroyed, and the other - bringing democracy to the Middle East - has been indefinitely postponed.
Nothing new in any of this, of course. Anti-war commentators have repeated it all again and again, while pro-war commentators mostly avoid mentioning any of it.
More importantly, the war has shown the limits of American power. It is clear the United States can only manage to fight two small wars at a time.
Iraq and Afghanistan have stretched the US armed forces almost to breaking point. America after the invasion of Iraq is no longer the superpower it was before.
Yet American resilience and inventive power seem to have turned the corner here, at least in military terms. Tactics which were losing the war have been abandoned, and new, more intelligent tactics have taken their place.
Now, the American forces are engaged in fighting a rearguard action, winning time during which the long-term decisions can be taken about withdrawal or some form of continuing presence here.
Some people - for instance Senator John McCain, the Republican candidate for the White House - will no doubt call this rearguard action a success. He may even be tempted to call it a victory.
Yet at present it is hard to think of it as particularly successful.
On Monday, Vice-President Dick Cheney came to Baghdad and talked about "the phenomenal improvement in security". That day more than 60 Iraqis were killed in bomb attacks.
He had to travel with unprecedented numbers of bodyguards, even though he never left the heavily defended Green Zone. Two mortar rounds hit the Zone while he was there.
None of this feels like a phenomenal improvement in security.
Still, ever since the start of 2007, when Gen David Petraeus started introducing radically new tactics, the war has entered a different phase.
The various elements in the insurgency have been divided, the Mehdi Army has been persuaded to keep its head down, and the American and Iraqi forces have gone on the offensive, denying their enemy the chance to dig in and control territory.
Before Gen Petraeus took over, American military tactics were negative, and sometimes seemed almost defeatist.
Dick Cheney has vowed the US mission in Iraq will be completed
The insurgents were able to operate at will along the main roads in Baghdad. They took over entire suburbs and towns.
At the same time there was a breathtaking lack of political understanding.
In the first year after the invasion, Iraqi politicians found the American proconsul, Paul Bremer, both arrogant and silly. He made a number of elementary errors which have caused lasting damage.
Nowadays, by contrast, the face of American policy here is Ryan Crocker, the US ambassador to Iraq. He speaks good Arabic and has a sympathetic understanding of the country and its people.
Altogether, the American military and diplomatic presence here has much more professionalism and intellectual seriousness to it.
Iraqi friends of mine who once hated the fact that the Americans were here now praise them for driving the militants from the streets. That is a real success.
But it is small compared with the damage which the war has done to America's reputation. The US state department finds it much harder nowadays to be taken seriously when it criticises other countries for their use of torture and arbitrary arrest.
Violence is down, but Iraqis continue to be killed
People the world over have been repelled by things that have been done here: things that are now associated with place-names like Abu Ghraib, Haditha, and Falluja.
Above all, we have seen how hard it is for the Americans to deal with a few thousand lightly armed volunteers.
Germany's 19th-Century Chancellor, Otto von Bismarck, said that great powers had to be very careful when they put their military strength to the test. Unless they are overwhelmingly successful, he meant, the perception will be that they have been defeated.
In spite of the new successes on the ground here, that is the long-term danger America faces.