US defence chief Leon Panetta has officially ended the US's military presence in Iraq by saying that "the dream of an independent and sovereign Iraq is now a reality" at a ceremony at the US military headquarters in Baghdad.
Thursday's flag-casing ceremony in the Iraqi capital comes ahead of the final withdrawal of all US troops from the country by the end of the year, prompting celebrations for many Iraqis but also uncertainty regarding the stability of the country.
Nearly nine years after the start of the controversial invasion that toppled Saddam Hussein and sparked years of violence, Panetta told Iraqis "Your children will have a better future", and said the US and Iraq would have "a new relationship rooted in mutual interest and mutual respect".
"We are not about turn our backs on all that has been sacrificed and accomplished in Iraq," Panetta said.
"Iraq will be tested in the days ahead by terrorism, by those who would seek to divide, by economic and social issues ... by the demands of democracy itself," he said, while adding that the US would be a "committed friend and ... partner" to the country.
General Lloyd Austin, the commander of US forces in Iraq, said that the country would be "a source of stability and inspiration in the region".
Panetta and Austin were joined at the ceremony by US Ambassador to Iraq James Jeffrey, Chairman of the US Joint Chiefs of Staff General Martin Dempsey and US Central Command chief General James Mattis.
Iraq was represented by military Chief of Staff Lieutenant-General Babaker Zebari and Defence Ministry SpokesmanMajor-General Mohammed al-Askari.
Mohammed al-Askari, the defense ministry spokesman, told Al Jazeera that the departure of the American forces will help hasten Iraq's progress.

"We have to depend on ourselves. Iraq is a big country, with its people and history, and cannot rely on another country to protect it. We are not afraid of this, our capabilities are growing rapidly, and we have the ability to protect Iraq," he said.

There are currently about 4,000 US troops still in Iraq, operating out of two bases in Diwaniya and Bhiqar provinces. That number is down from 170,000 at the height of the war.
A small contingent of troops remain in Baghdad, but will pull out following Thursday's ceremony.
While US President Barack Obama lauded the achievements of some of the last US troops to return home on Wednesday, residents of Baghdad were jubilant that the soldiers were leaving.
"I'm very happy because the occupier is leaving the nation ... the country will be ruled by its sons who will maintain it and keep its sovereignty," Salah al-Asadi, a tribal leader, told Al Jazeera.
"It's a joy for all Iraqis, not only for me. The US withdrawal from Iraq is something very big for us ... because the country’s security will be in the hands of our brothers at the police and the army, they are from us," said Abdelaziz Adel, a public servant.

'Situation unstable'
"If the Americans have achieved anything, they have achieved it to their own benefit in the first place. They are the ones who get benefits from this issue. As for Iraqis, maybe they have the change they have been waiting for, but they paid high price for it as you can see the killings, devastation and sectarian violence. And up to now the situation is still unstable," said Qassim Abdullah, an Iraqi citizen.
While US troops are pulling out, Washington is ramping up its diplomatic presence in Iraq, reported Al Jazeera's Jane Arraf from Baghdad.
"The US presence here will shift to a diplomatic, political and very much an economic one. To do that, they're keeping a huge embassy. It will be the biggest US embassy in the world ... between 15,000 and 16,000 people," she reported.
There are concerns among regular Iraqis that the US will leave behind a country that is politically unstable, Al Jazeera's Omar al-Saleh reported from Baghdad's central Tahrir Square.
The US president paid tribute on Wednesday to about 3,000 soldiers gathered at the Fort Bragg military station in North Carolina on Wednesday, saying he was proud to welcome them home after what he called an "extraordinary achievement".
"Over the last few months, the final work of leaving Iraq has been done. Dozens of bases ... that house American troops have been closed down or turned over to the Iraqis," Obama said, adding that troops would leave the country "with their heads held high".