You will leave with great pride - lasting pride-secure in knowing that your sacrifice has helped the Iraqi people to begin a new chapter in history.

That was one of U.S. Defense Secretary Leon Panetta's memorable messages to the few thousands of troops participating in a ceremony at Baghdad International Airport that marked the formal end to the nine-year war in Iraq that reportedly claimed about 4,500 American lives, wounded another estimated 32,000 and cost more than $800 billion. Nearly 100,000 Iraqis have died as well.

Panetta and several other U.S. diplomatic, military and defense leaders, including Army Gen. Martin Dempsey, the chairman of the Joint Chiefs of Staff, and Gen. Lloyd Austin, the top U.S. commander in Iraq, made remarks during a symbolic ceremony in which the flag of U.S. Forces-Iraq was officially retired, or cased, according to Army tradition. The flag was furled around a flagpole and covered in camouflage and will be brought back to the United States.

During a stop in Afghanistan this week, Panetta described the nine-year mission in Iraq as making that country sovereign and independent and able to govern and secure itself, which, Panetta added, was a tribute to everybody - everybody who fought in that war, everybody who spilled blood in that war, everybody who was dedicated to making sure we could achieve that mission.

Perhaps in what summed up the entire war, Panetta said later that the war was worth the price in blood and money, as it set Iraq on a path to democracy.

Iraqi citizens had a different take on it all, though, according to reports.

The Americans are leaving behind them a destroyed country, said Mariam Khazim of Sadr City. The Americans did not leave modern schools or big factories behind them. Instead, they left thousands of widows and orphans.

The American ceremony represents the failure of the U.S. occupation of Iraq due to the great resistance of the Iraqi people, said Sadrist lawmaker Amir al-Kinani.

As of Thursday, there were two U.S. bases and about 4,000 U.S. troops in Iraq, a stark drop from the roughly 500 bases and 170,000 troops during the surge ordered by President George W. Bush in 2007, when the war reached its boiling point. All U.S. troops are scheduled to withdraw from Iraq by the end of the year, but reports say officials are likely to meet that goal a little bit before then. Over the coming days, the final few thousand U.S. troops will leave Iraq in orderly caravans and tightly scheduled flights, according to Fox News Latino.  

Nevertheless, an early exit might make some military leaders worry about the strength of Iraqi security forces that are still maturing and are facing continuing struggles to develop logistics, air operations, surveillance and intelligence sharing capabilities.

Before Thursday's ceremony, Panetta acknowledged the difficulties Iraq will face in the coming years.

They're going face challenges in the future, Panetta said Wednesday during his visit with troops in Afghanistan. They'll face challenges from terrorism, they'll face challenges from those that would want to divide their country. They'll face challenges from just the test of democracy, a new democracy and trying to make it work. But the fact is, we have given them the opportunity to be able to succeed.