As President Barack Obama promised, the war in Iraq has finally come to an end.

Standing in front of hundreds of soldiers on Thursday morning, U.S. Defense Secretary Leon Panetta called a formal close to the conflict that's lasted 8 years, 9 months, at a cost of more than $1 trillion, along with hundreds of thousands of lives.

"You will leave with great pride, lasting pride," Panetta said, according to The Associated Press. "Secure in knowing that your sacrifice has helped the Iraqi people to begin a new chapter in history."

A total of 4,484 U.S. soldiers were killed in the war, launched after the George W. Bush administration wrongly declared that former dictator Saddam Hussein had weapons of mass destruction that posed a threat to the region. Over 100,000 Iraqi civilians were killed, along with 318 soldiers from the slim U.S. coalition forces.

An almost unthinkable 32,200 American men and women were severely wounded fighting in the war, which lasted more than twice as long as World War II and cost over $1 trillion. Initial estimates from the Bush administration predicted the war would cost, at most, $50 to $60 billion.

By comparison, the Congressional Research Service estimates that the Vietnam war cost $738 billion, adjusted for inflation. America's involvement in that conflict was four months shorter than its occupation of Iraq, although it left 58,156 U.S. service members dead, along with more than 1 million Vietnamese casualties.

"To be sure, the cost was high, in blood and treasure for the United States, and also for the Iraqi people," Panetta said. "But those lives have not been lost in vain."

President Obama, who campaigned on ending the Iraq war, announced in October that U.S. troops would be home in time for the holidays, telling Americans: "After a decade of war, the nation we need to build, the nation we will build, is our own."

Most had expected Obama to announce an brief extension of U.S. military presence in the country.

While the U.S. occupation of Iraq is ending, the overall U.S. presence will endure. An estimated 16,000 U.S. embassy staff and a handful of diplomats will remain, along with a contingent of security contractors, whose mission it will be to continue the U.S. relationship with the Iraqi government.

"Your dream of an independent and sovereign Iraq is now a reality," Panetta said, addressing members of the Iraqi parliament.

President Obama has pledged that the U.S. will be an enduring partner for Iraq moving forward.

Watch the war formally come to a close in the Associated Press videos below, the last of which features the retiring of U.S. colors.