Washington (CNN) -- Just hours before the official end of Operation Iraqi Freedom, Defense Secretary Robert Gates grew emotional when discussing the toll it has taken on American men and women in uniform.
"Today, at the end of Operation Iraqi Freedom, 4,427 American service members have died in Iraq, 3,502 of them killed in action; 34,265 have been wounded or injured," Gates said, appearing to choke up before an audience at the American Legion convention in Milwaukee Tuesday. "We must never forget."
Gates also warned that while the U.S. military can point to many accomplishments there, all is not "well in Iraq."
"The most recent elections have yet to result in a coalition government. Sectarian tensions remain a fact of life. Al Qaeda in Iraq is beaten, but not gone," he said. "This is not a time for premature victory parades or self-congratulation."
He pointed out that not long ago, during the start of the "surge," the increase in U.S. troops in the country, Iraq seemed like a lost cause and many were saying it was time for the United States to pull out. Gates compared that to the current situation in Afghanistan.
"Three and a half years ago very few believed the surge could take us to where we are today in Iraq, and there were plenty of reasons for doubts," he said. "Back then, this country's civilian and military leadership chose the path we believed had the best chance of achieving our national security objectives -- as we are doing in Afghanistan today. Success there is not inevitable. But with the right strategy and the willingness to see it through, it is possible. And it is worth the fight."
He spelled out why succeeding in Afghanistan is so crucial: "The Taliban are a cruel and ruthless adversary, and are not going quietly. Their leadership has ordered a brutal campaign of intimidation against Afghan civilians, singling out women for barbaric attacks. But the enemy is paying a price for its crimes, as more than 350 Taliban commanders have been killed or captured just in the past three months."
Gates ended his address with a promise to do all he can to help America's troops.
"These talented and resilient men and women in uniform are the ones who give me confidence in the future, as there is no group of people at any time or any place more capable of confronting the challenges our country faces," he said. "The debt owed by all Americans to those now serving, and those who have served, can never be fully repaid."