U.S. forces formally ended their nine-year war in Iraq on Thursday with a low key flag ceremony in Baghdad, while to the north flickering violence highlighted ethnic and sectarian strains threatening the country in years ahead.
"After a lot of blood spilled by Iraqis and Americans, the mission of an Iraq that could govern and secure itself has become real," Defense Secretary Leon Panetta said at the ceremony at Baghdad's still heavily-fortified airport.
Almost 4,500 U.S. soldiers and tens of thousands of Iraqis lost their lives in the war that began with a "Shock and Awe" campaign of missiles pounding Baghdad and descended into sectarian strife and a surge in U.S. troop numbers.
U.S. soldiers lowered the flag of American forces in Iraq and slipped it into a camouflage-colored sleeve in a brief outdoor ceremony, symbolically ending the most unpopular U.S. military venture since the Vietnam War of the 1960s and 70s.
The remaining 4,000 American troops will leave by the end of the year.
Toppled Iraqi leader Saddam Hussein is dead, executed in 2006and the worst sectarian violence has, at least for now, passed. But Iraq still struggles with insurgents, a fragile power-sharing government and an oil-reliant economy plagued by power shortages and corruption.
"Iraq will be tested in the days ahead, by terrorism, by those who would seek to divide, by economic and social issues," Panetta told the rows of assembled U.S. soldiers and embassy officials at the ceremony. "Challenges remain, but the United State s will be there to stand by the Iraqi people."
In Falluja, the former heartland of an al Qaeda insurgency and scene of some of the worst fighting in the war, several thousand Iraqis celebrated the withdrawal on Wednesday, some burning U.S. flags and waving pictures of dead relatives.
Around 2,500 mainly Shi'ite muslim residents of the northern territory of Diyala protested on Thursday in front of the provincial council building for a second day against a move to declare autonomy from the mainly Sunni Salahuddin province.
Police used batons and water cannon to disperse demonstrators who tried to storm the council headquarters, witnesses said. Some protesters climbed to the roof of the building and raised green and black Shi'ite flags.
Some parts of Diyala are disputed territories between the minority Kurds in the north and Arab Shi'ite-led government in Baghdad. The long-standing dispute over land, oil and power is considered a potential flashpoint for future conflict in Iraq after American troops depart.
Iraq's neighbors will watch how Baghdad tackles its sectarian and ethnic division without the U.S. military. Events there could be influenced by conflict in neighboring Syria that has taken on a sectarian hue in recent weeks.
U.S. President Barack Obama, who made an election promise to bring troops home, told Iraqi Prime Minister Nuri al-Maliki that Washington will remain a loyal partner after the last troops roll across the Kuwaiti border.
Iraq's Shi'ite leadership presents the withdrawal as a new start for the country's sovereignty, but many Iraqis question which direction the nation will take without U.S. troops.
"I am happy they are leaving. This is my country and they should leave," said Samer Saad, a soccer coach. "But I am worried because we need to be safe. We are worried because all the militias will start to come back."
Some like Saad fear more sectarian strife or an al Qaeda return to the cities. A squabble between Kurds in their northern semi-autonomous enclave and the Iraqi Arab central government over disputed territories and oil is another flashpoint.
Violence has ebbed since the bloodier days of sectarian slaughter when suicide bombers and hit squads claimed hundreds of victims a day at times as the country descended into tit-for-tat killings between the Sunni and Shi'ite communities.
In 2006 alone, 17,800 Iraqi military and civilians were killed in violence.
Iraqi security forces are generally seen as capable of containing the remaining Sunni Islamist insurgency and the rival Shi'ite militias that U.S. officials say are backed by Iran.
But attacks now target local government offices and security forces in an attempt show the authorities are not in control.
Saddam's fall opened the way for the Shi'ite majority community to take positions of power after decades of oppression under his Sunni-run Baath party.
Even the power-sharing in Maliki's Shi'ite-led government is hamstrung, with coalition parties split along sectarian lines, squabbling over laws and government posts.
Sunnis fear they will be marginalised or even face creeping Shi'ite-led authoritarian rule under Maliki. A recent crackdown on former members of the Baath party has fueled those fears.
Iraq's Shi'ite leadership frets the crisis in neighbouring Syria could eventually bring a hardline Sunni leadership to power in Damascus, worsening Iraq's own sectarian tensions.
U.S. troops were supposed to stay on as part of a deal to train the Iraqi armed forces but talks over immunity from prosecution for American soldiers fell apart.
Memories of U.S. abuses, arrests and killings still haunt many Iraqis and the question of legal protection from prosecution looked too sensitive to push through parliament.
At the height of the war, 170,000 American soldiers occupied more than 500 bases across the country.
Only around 150 U.S. soldiers will remain after Dec. 31 attached to the huge U.S. Embassy near the Tigris River. Civilian contractors will take on the task of training Iraqi
forces on U.S. military hardware.
Every day trucks with troops trundle in convoys across the Kuwaiti border.
"Was it worth it? I am sure it was. When we first came in here, the Iraqi people seemed like they were happy to see us," said Sgt 1st Class Lon Bennish, packing up recently at a U.S base and finishing the last of three deployments in Iraq.
"I hope we are leaving behind a country that says 'Hey, we are better off now than we were before.'"
Want to enjoy 'Zen' reading - with no ads and just the article? Subscribe todaySubscribe now