15 December 2011 Last updated at 12:04 GMT
Only about 4,000 US soldiers now remain in Iraq, but they are due to leave in the next two weeks.
At the peak of the operation, US forces there numbered 170,000.
The symbolic ceremony in Baghdad officially "cased" (retired) the US forces flag, according to army tradition.
It will now be taken back to the USA.
The Practical Buddhist Responds
It's been the second-most unpopular war in U.S. history, and in my opinion, an ongoing violation of every major Buddhist teaching about killing and lying and compassionate conduct. I honor the soldiers and officers who served there and the few who remain. We sent them and they deserve our best support and love when they return. I don't know why we needed this war, and whether anything about it was just, but the soldiers are not to blame. Responsibility belongs to politicians and to an apathetic public.
Some predict autonomy and stability in Iraq, now that we are going. Others fear a bloodbath. Either way we all need to examine our consciences: was this war right? Did it serve good ends for all involved?