WASHINGTON —The war in Iraq is officially over. The costs will go on.

Eight years of dodging improvised explosive devices, repelling insurgent ambushes and quelling sectarian strife already have drained the United States of more treasure than any conflict in the nation's history except World War II.

Even though the last U.S. combat troops have left Iraq, American taxpayers will face decades of additional expenses, from veterans' health care and disability benefits to interest on the debt accumulated to finance the war.

"Those costs are going to build for years," said Todd Harrison, a senior fellow at the Center for Strategic and Budgetary Assessments, a Washington-based research group.

That burden will come amid growing concern about the federal government's debt, with cuts to popular programs such as Medicare and to national defense being debated. Spending so far on the war and related interest payments make up about a tenth of the U.S. Treasury's $10.4 trillion in publicly held debt.

Direct federal spending on the war through 2012 will reach $823 billion, surpassing the $738 billion in inflation-adjusted dollars the United States spent on the Vietnam War, the Congressional Research Service estimated in a March 29 report. Only World War II had a higher direct cost, $4.1 trillion, in current dollars.

Not counted in that is the interest of more than $200 billion the federal government has already had to pay on the resulting debt, said Linda Bilmes, a senior lecturer in public finance at Harvard's Kennedy School of Government.

Bilmes also estimates the price over the next 40 years of health care and disability compensation for veterans of the Iraq and Afghanistan conflicts will be almost $1 trillion. "The veterans' costs in particular will dwarf the other budget costs," said Bilmes.

By any measure, the price of the Iraq conflict has far outstripped forecasts by President George W. Bush's administration as it made the case to go to war. Then-White House budget director Mitch Daniels and Defense Secretary Donald Rumsfeld projected the United States would spend $50 billion to $60 billion and said they believed part of that would be defrayed by other countries.

Still, while the conflict turned out to be among the most expensive in the nation's history, the size of the U.S. economy is now larger than in earlier wars and so is the nation's capacity to bear the financial load.

The choice to avoid tax increases and pay for the war entirely through budget deficits has compounded the long-term economic impact.

The direct cost of the Iraq war to date is about as large as the Obama administration's 2009 economic stimulus, which the Congressional Budget Office estimated at $825 billion in an Aug. 24 report.

The impact will reverberate beyond the federal budget.

The war has exacted a toll on the broader economy as its consequences rippled through families, businesses and world oil and financial markets.