December 15, 2011 - 20:57 AMT
U.S. flag lowered in Baghdad

The flag of American forces in Iraq has been lowered in Baghdad, bringing nearly nine years of US military operations in Iraq to a formal end.

The US Defence Secretary, Leon Panetta, told troops the mission had been worth the cost in blood and dollars.

He said the years of war in Iraq had yielded to an era of opportunity in which the US was a committed partner.

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.

Mr. Panetta told US soldiers they could leave Iraq with great pride.

"After a lot of blood spilled by Iraqis and Americans, the mission of an Iraq that could govern and secure itself has become real," he said.

Iraqi Deputy Prime Minister Hussain al-Shahristani said Iraqis were glad the US troops were leaving.

"I think we are all happy that the American soldiers are returning home safely to their families and we are also confident that the Iraqi people and their armed forces, police, are in a position now to take care of their own security."

Some 4,500 US soldiers and more than 100,000 Iraqis have died in the war.

The conflict, launched by the Bush administration in March 2003, soon became hugely unpopular as claims that Saddam Hussein was hiding weapons of mass destruction and supporting al-Qaeda militants turned out to be untrue.

The war has cost the US some $1tr.

Republicans have criticized the pullout citing concerns over Iraq's stability, but a recent poll by the Pew Research Centre found that 75% of Americans backed the troop withdrawal, BBC reported.