(CNN) -- President Barack Obama on Wednesday welcomed home returning troops from Iraq, hailing their service to help a people they didn't know as an example of what makes America great.
"As your commander in chief, and on behalf of a grateful nation, I'm proud to finally say these two words, and I know your families agree -- welcome home. Welcome home," Obama told cheering troops at Fort Bragg, North Carolina.
"Welcome home," he repeated again, to enthusiastic applause. "Welcome home."
The U.S. military mission that began in 2003 is ending this month, and Obama used the speech to mark the fulfillment of a campaign pledge he made in 2008 to end the war.
Noting the almost 4,500 Americans killed and more than 30,000 injured, Obama spoke of the heavy sacrifice and hard work in the Iraq mission.
"Because of you -- because you sacrificed so much for a people that you had never met, Iraqis have a chance to forge their own destiny," Obama said. "That's part of what makes us special as Americans. Unlike the empires of old, we did so not for territory or for resources. We do it because it's right.
"There can be no fuller expression of America's support for self-determination than our leaving Iraq to its people. That says something about who we are."
Obama also paid tribute to the military families back home, noting their struggles to make ends meet during the years of the Iraqi campaign.
"So today, as we mark the end of the war, let us acknowledge, let us give a heartfelt round of applause for every military family that has carried that load over the last nine years," the president said. "You too have the thanks of a grateful nation."
Conservative critics have opposed Obama's decision to end the U.S. military presence in Iraq, arguing that some American forces should remain to help the Iraqis maintain order.
On Wednesday, Obama's opponent for the presidency in 2008 -- Republican Sen. John McCain of Arizona -- noted the president had opposed the troop surge ordered by former President George W. Bush that some credit with helping secure stability.
"For three years, the president has been harvesting the successes of the very strategy that he consistently dismissed as a failure," McCain said on the Senate floor.
Sharply criticizing the decision for a full withdrawal, McCain said history would judge Obama's leadership "with the disdain and scorn it deserves."
In his speech, Obama said the Iraq war was "a source of great controversy here at home, with patriots on both sides of the debate."
"It is harder to end a war than to begin one," the president continued in an apparent response to critics such as McCain.
Noting that Iraq today is not a "perfect place" and faces challenges, Obama said, "We are leaving behind a sovereign, stable and self-reliant Iraq, with a representative government that was elected by its people."
He said, "We are building a new partnership between our nations. And we are ending a war not with a final battle but with a final march toward home."
He credited the efforts of the 1.5 million Americans in Iraq during the war, and said those who served would be honored in perpetuity.
"The war in Iraq will soon belong to history," Obama said. "Your service belongs to the ages."
Obama also pledged continued government support for the military, and for troops and their families after they return to civilian life, even in the face of deficit reduction efforts that threaten deep cuts in the military budget.
"Make no mistake, as we go forward as a nation, we are going to keep America's armed forces the strongest fighting force the world has ever seen. That will not stop," Obama said to cheers and applause, repeating: "That will not stop."
In Washington, a group of conservative Republican senators said Wednesday they intend to propose legislation that would prevent mandated reductions in military spending after a special congressional committee failed to reach a deficit reduction deal last month.
The so-called sequestration trigger under the debt ceiling agreement in August required an additional $600 billion in military cuts because of the special committee's failure to forge a comprehensive deficit deal.
Obama has said he would reject any effort by Congress to avoid the impact of the sequestration trigger, which was included in the debt ceiling deal to motivate legislators to reach agreement on a broader deficit reduction plan.
Sen. Lindsey Graham, R-South Carolina, challenged Obama to rescind his veto threat, saying deficits can be reduced without "gutting" the military.