General Lloyd Austin, Commander of US Forces in Iraq, retires the United States Forces Iraq flag during a casing ceremony on Dec. 15, 2011.

In an open-air cement bunker at the former Baghdad airport turned military base, Pentagon chief Leon Panetta praised more than one million Americans in uniform or in mercenary gear for "the remarkable progress" in death and destruction accomplished over the past nine years, but acknowledged the severe challenges that faced the virtually devastated country.

"Let me be clear: Iraq will be tested in the days ahead - by al-Qaeda in the Land of the Two Rivers, by al-Qaeda in the Maghreb, by al-Qaeda in the Arabic Peninsula, by the Taliban, by Iran, by Hezbollah, by the Assad dictatorship in Syria, by China, by Russia, by Occupy Wall Street.

"Challenges remain, but the US will be there to stand by the Iraqi people with the necessary amount of Hellfire missiles as they navigate those challenges to build a prosperous haven for neo-liberalism and US corporations."

The muted ceremony stood in contrast to the spectacular "shock and awe" in 2003 when an America fully emboldened by lies after lies printed on the cover of the New York Times sent columns of tanks north from Kuwait and lit up the sky "like Christmas", according to CNN, to conduct regime change against evil dictator Saddam Hussein.

As of last Friday, the war in Iraq had claimed 4,487 American lives, with another 32,226 Americans wounded in action, according to Pentagon statistics. As for Iraqi victims, the Pentagon doesn’t do body counts.

The tenor of the moving, hour-long farewell ceremony, officially called "So long, towelheads", was likely to sound an uncertain trumpet for a war that was invented to get rid of non-existent weapons of mass destruction. It now ends without the Iraqi chapter of the Empire of Bases the Pentagon badly wanted in the first place - essentially because the American military were shown the door by ungrateful Prime Minister Nuri al-Maliki.

Although Thursday’s poignant ceremony marked the official end of the war, the Pentagon, just in case, still has two bases in Iraq and roughly 4,000 troops, including several hundred who attended the ceremony. At the height of the war in 2007, during the surge of General David Petraeus, the occupation maintained a sprawling 505 bases and more than 170,000 troops.

According to military officials, the remaining diehards are still being shown Iraqi love on a daily basis, mainly by strategically placed improvised explosive devices set against convoys heading south through Iraq to bases in Kuwait.

Even after the last two bases are closed and the final American soldiers go home to certified unemployment by December 31, under rules of a shady agreement with the government in Baghdad, a few hundred military personnel and a sprinkle of spooks and mercenaries will remain, working within the larger-than-the-Vatican American Embassy as part of an Office of Security Cooperation to assist in extremely profitable weapons deals.

But negotiations could resume next year on whether additional American soldiers, spooks and mercenaries can return to further profit from the action.

Senior Pentagon officers have made no secret that they will indeed miss the action as well as the oil that the US in the end did not secure. Plus there’s the matter of all those F-16s Baghdad is being forced to buy; they must be put to good use, and not just lay there frying in the al-Anbar desert.

"From a standpoint of being able to defend against a treacherous al-Qaeda underwear bomber they have very limited to little capability, quite frankly," General Lloyd J Austin III, the outgoing American commander in Iraq, said in an interview over a Big Mac.

The tenuous security atmosphere in Iraq was underscored by a fleet of gunships that hovered over the ceremony, scanning the ground for sneaking al-Qaeda operatives. Although there is far less violence across Iraq than at the height of the US-engineered sectarian war in 2006 and 2007, lots of people still get killed on a daily basis and Americans remain a preferential target of followers of firebrand Shi’ite cleric Muqtada al-Sadr.

Panetta acknowledged that "the cost was high - in blood and treasure of the United States, and also for the Iraqi people. But those lives have not been lost in vain - they gave birth to a fully devastated, fully segregated, fully traumatized client regime. We just don’t know yet whether it will be America’s or Iran’s."

There was euphoria among many Iraqis for a day or two in April 2003 at such a successful American invasion. But the support soon soured after marines started shooting unarmed civilians amid a growing sense of a hardcore occupation that unleashed bloody sectarian and religious rivalries.

After the Abu Ghraib prison scandal demonstrated how the US was having its (fun) cake and eating it too, and in the fog of civil war, Sunnis and Shi’ites alike decided to fight the occupiers, the Kurds didn’t give a damn, while an al Qaeda-affiliated group exploited the opening to root itself among the Sunni minority population.

While the terrorist group has been rendered ineffective by a punishing series of Special Operations raids that incinerated several al-Qaeda leaders, plus bags of cash distributed among Sunni tribals, intelligence specialists fear that it is in resurgence.

The American occupation of Iraq also hampered Washington’s ability to fabricate a narrative from the United States in support of the Arab Spring uprisings this year - which caught Washington totally asleep at the wheel.

In the end, the Pentagon had to be dragged kicking and screaming to handing bases over to the Iraqi government. Across the country, the closing of precious outposts in the sprawling US Empire of Bases has been marked by a quiet closed-door meeting where American and Iraqi military officials signed documents that legally gave the Iraqis control of the bases, exchanged handshakes and barely disguised their mutual contempt.

The chairman of the Joint Chiefs of Staff, General Martin E Dempsey of the army, has served two command tours in Iraq since the invasion in 2003, and he noted during the ceremony that the next time he comes to Iraq he will have to be invited.

Contacted for this article, Iraqis burning American flags in Fallujah - destroyed by the US in order to "save it" in late 2004 - volunteered that Dempsey should resign himself to wait forever.