The US flag is to be lowered in Baghdad, formally marking the end of US military operations in Iraq after nearly nine years of war. Most of the 5,500 remaining soldiers have now left Iraq, with security in the hands of the Iraqi authorities. President Barack Obama, who came to office pledging to bring troops home, said the US left behind a \"sovereign, stable and self-reliant Iraq\". Some 4,500 US soldiers and more than 100,000 Iraqis have died in the war. It has cost the US some $1tr. Republicans have criticised the pullout citing concerns over Iraq\'s stability, but most Americans support the move. In a speech to troops just returned from Iraq in North Carolina on Wednesday, Mr Obama hailed the \"extraordinary achievement\" of the military and said they were leaving with \"heads held high\" \"Everything that American troops have done in Iraq, all the fighting and dying, bleeding and building, training and partnering, has led us to this moment of success,\" he said. \"The war in Iraq will soon belong to history, and your service belongs to the ages.\" He said the war had been \"a source of great controversy\" but that they had helped to build \"a sovereign, stable and self-reliant Iraq, with a representative government that was elected by its people\". Some 1.5 million Americans have served in Iraq since the US invasion in 2003. In addition to those who died, nearly 30,000 have been wounded. Troop numbers peaked at around 170,000 during the height of the so-called surge strategy in 2007, but as of this week only about 5,500 remained. Many of them have already left for bases in Kuwait prior to flying home. The last combat troops left Iraq in August last year. A small contingent of some 200 soldiers will remain in Iraq as advisers, while some 15,000 US personnel are now based at the US embassy in Baghdad - by far the world\'s largest. Some Iraqis have said they fear the consequences of being left to manage their own security. Baghdad trader Malik Abed said he was grateful to the Americans for ridding Iraq of Saddam Hussein, but added: \"I think now we are going to be in trouble. Maybe the terrorists will start attacking us again.\" But in the city of Falluja, a former insurgent stronghold which was the scene of major US offensives in 2004, people burned US flags on Wednesday in celebration at the withdrawal. \"No-one trusted their promises, but they said when they came to Iraq they would bring security, stability and would build our country,\" Ahmed Aied, a grocer, told Reuters news agency. \"Now they are walking out, leaving behind killings, ruin and mess.\" Concerns have also been voiced in Washington that Iraq lacks robust political structures or an ability to defend its borders. There are also fears that Iraq could be plunged back into sectarian bloodletting, or be unduly influenced by Iran. The conflict, launched by the Bush administration in March 2003, soon became hugely unpopular as claims that Saddam was hiding weapons of mass destruction and supporting al-Qaeda militants turned out to be untrue. It descended into sectarian conflict, costing tens of thousands of Iraqi lives. Mr Obama announced in October that all US troops would leave Iraq by the end of 2011, a date previously agreed by former President George W Bush in 2008.