At an official ceremony to end the war in Iraq, US defence secreatry Leon Panetta said 'the mission of an Iraq that could govern and secure itself has become real' Reuters

There was no triumphalism and certainly no shock or awe. The end of the war in Iraq was subdued and simple: a small band playing as the US forces flag was furled with 200 troops watching quietly. In a makeshift parade ground in a corner of Baghdad airport, time was called on the war just after 1pm on Thursday, eight years, eight months and 26 days after its more dramatic opening in March 2003. Nearby a plane was waiting to take home the US high command. And in southern Iraq, the 4,000 US troops who remain were streaming towards Kuwait.

By Sunday all the troops will be gone, called home for Christmas by an administration that decided there was little point sticking to the original end date of 31 December. The Iraqi government had made clear that it no longer wanted a US presence here, and any soldier who stayed behind would not be granted legal immunity.

To the end, the relationship between Iraq and the departing US commanders remained difficult to gauge. The prime minister, Nouri al-Maliki, and the president, Jalal Talabani, did not turn up to the ceremony, with uniformed US soldiers belatedly moved into seats carrying the two Iraqi leaders' names.

Some of the soldiers who will soon cross the border will remain in Kuwait for several months. But the vast majority of people in a country that has seen about 1.5 million US soldiers rotate through are unlikely to ever see another. Only 159 uniformed troops and officers, as well as a marine guard corps, will remain in the US embassy in the heart of Baghdad's green zone.

"You came to this land between the rivers again and again and again," said the United States defence secretary, Leon Panetta, who arrived from Afghanistan just over an hour before the ceremony began. "You will leave with great pride – lasting pride."

Minutes earlier, the last US commanding general in Iraq, Lloyd J Austin III helped wrap the USFI banner around a flagpole, then cover it in camouflage.

Panetta, previously the CIA chief, said the war was worth the enormous price in blood and treasure – about $750bn (£484bn), 4,500 dead, 32,000 wounded, and that's just on the American side.

Iraqi casualties are far higher, with civilian deaths well over 100,000, many more maimed, and up to several million people displaced at the height of what became a vicious two-year sectarian war.

Despite two democratic elections, an estimated $62bn in US aid money, and the close diplomatic attention of the war's protagonists, Iraq is still grappling with a range of issues. Basic services remain poor, the political class unaccountable, a rule of law absent, and a government vulnerable to the whims of the region. There has been little progress on other touchstone issues, such as long simmering territorial disputes and national reconciliation.

What will become of the country is preoccupying its people. There are many here who had grown accustomed to the safety net of US forces, which despite Thursday's formal departure had rarely been seen on the streets of the country's cities since mid-2009, when a joint security pact came into effect. Many Iraqis fear profound uncertainty ahead and a reluctance to face up to yet another jolt to Iraq's power dynamic.

The spectre of Iran stepping into an American vacuum gets regular play in non-government media and in Sunni areas of the country, which still feel collectively marginalised eight years after their power base was shattered. Over the past fortnight three Sunni provinces have declared their intention to be independent members of a federal system.

Panetta, as well as the commander of the joint chiefs of staff, General Martin Dempsey, framed the past two years as a steady withdrawal that had led to Thursday's symbolic moment. Both men set an optimistic tone for what they see as a country that has found its feet and no longer needs them.

On the streets of Baghdad, the ceremony caused little fuss. It was carried live by state television, but groups of men in several coffee halls in the city's eastern suburbs largely remained ambivalent.

Assad Mohammed, 48, a spare parts shop owner, said: "I don't have any emotions about the events of today. I'm not happy and I'm not sad.

"Whether they are here or not, it's the same. Stability isn't in the hands of the government, or the Americans. It's in the hands of the Iraqi people.

"Sovereignty is not something that will be given to us. Sovereignty is when the people step forward and take it."

Another man, Mundhar Kamel, 65, said the departure changed little. "This move is them exiting from one door and entering from another," he said. "In the embassy they still have 15,000 people and there is talk about 3,000 more [military] trainers. This is not a withdrawal, this is an act on a stage.

"We haven't gained anything from the country. They destroyed the country and now they are leaving."

Adham Abul Razzak, 30, saw hope in the withdrawal. "I am very happy because of this withdrawal," he said. "I wish that this step would be the first towards unifying Iraqis and expelling sectarianism.

"The effect of the occupation is still with us because of the relations between the two sides and the presence of such a large embassy. I don't think there will be violence after the withdrawal – the opposite, in fact. But only if the neighbouring countries do not interfere in our business."

The generals left Baghdad in the mid afternoon, a military plane banking to the west over the vast and now abandoned base that ran the war for almost nine years. The Iraqi army will eventually move into the base known as Victory. In Baghdad on Thursday there was talk of renaming it. "It should be the Iraqi national academy," one man told a Baghdad radio station. "Or maybe 'Uncertainty'," the announcer replied.