The sudden collapse of Iraqi forces in the face of lightly armed insurgents has catalyzed an emotional debate within the U.S. military about a war that, just a few years ago, seemed on the brink of going down in history as a success.

In an echo of the post-Vietnam era, some military officers believe the war could and should have been won. They blame civilian leaders — chief among them President Obama — for failing to press harder for a political agreement that would have allowed the military to remain on the ground long enough to secure victory.

“Anyone who was there during the surge came away very encouraged about the future of the country if we had continued to stay engaged,” said retired Col. Peter Mansoor, who served as a top adviser to Gen. David H. Petraeus in Baghdad and wrote a history of the latter years of the war.

That argument is deeply reminiscent of the aftermath of the Vietnam War, when the Army blamed its defeat on President Lyndon B. Johnson and other micromanaging civilian leaders who put restrictions on the military’s use of firepower and chose bombing targets from the White House.

It’s countered by others who witnessed the chaos of the war up close. On his Facebook page, Maj. Andrew Rohrer, who served in Iraq as a junior officer, blamed feuding Iraqi politicians for the country’s collapse, calling the war “an Iraqi problem that we never could have fixed in a hundred years.”

Gen. Martin E. Dempsey, the chairman of the Joint Chiefs of Staff, on Wednesday acknowledged both arguments. The Iraqi army and police needed a longer-term U.S. military advisory presence to help with planning and logistics, he said, but a few thousand U.S. advisers wouldn’t have prevented the chaos caused by Iraqi political leaders’ score-settling and sectarian behavior.

“The problem today is that the [Iraqi] government hasn’t acted responsibly,” Dempsey said in Senate testimony.

How the U.S. military resolves today’s internal debate could have profound implications for the shape of its future force. Those who blame America’s political leaders for the recent failings in Iraq are more likely to support a big, conventional military that can, if needed, function as an effective occupation force. Skeptics are more inclined to champion a smaller military that relies more heavily on precision firepower, technology and advisers to support local fighters and minimize America’s potential losses.

The outcome of this internal debate could also influence the advice that top generals give regarding future conflicts. “Iraq has become a proxy for the debate about Afghanistan, Syria and Iran,” said Peter D. Feaver, a Duke University political scientist and former National Security Council official.

For both sides, the debate over who lost Iraq remains raw and emotional. Many of today’s military officers still carry fresh memories of friends killed in battle.

Iraq and the Iraqi people remain something of an abstraction. For much of the war, U.S. troops patrolled Iraq’s cities in lumbering armored vehicles and lived on heavily fortified bases surrounded by blast walls and barbed wire.

Some soldiers forged close bonds with Iraqi interpreters or the Iraqi officers who fought alongside them. Most, though, never really developed an affinity for the Iraqi people, their religion or their culture.

ISIS insurgents fired mortars at the oil refinery in Baiji, forcing the temporary shutdown of Iraq's largest gasoline processing plant. Here's what you need to know about the strategic importance of this refinery. (Davin Coburn and Kate M. Tobey/The Washington Post)

“My sadness is not for the Iraqis, but for the wasted effort so many of us gave and bought at so high a price,” said one Army officer granted anonymity so he could discuss his feelings about the conflict.

Michael Ramos, who served in Iraq with the Marines, recalled stopping an Iraqi man and his son south of Baghdad during the early days of the occupation. As he searched the elder Iraqi, Ramos noticed that his ears were missing. Through a translator, the Iraqi told Ramos he had fought during the Persian Gulf War in Kuwait. When he returned to Iraq, Saddam Hussein’s men cut off his ears as punishment.

“I’m really glad you’re here,” the Iraqi told Ramos. That was in 2003. Now, as Sunni insurgents fighting under the banner of the Islamic State of Iraq and Syria (ISIS) marched toward Baghdad, Ramos’s strongest memory of Iraq was the man with no ears. He struggled to imagine what life was like in a place that seemed foreign even when he was there. “We made a difference for that dude,” said Ramos, now 38 and a graduate student at the University of North Carolina at Wilmington.

The danger of the military’s current debate over Iraq is that it fails to take into account the military’s failings, said Eliot A. Cohen, who served as a senior State Department official during the last years of the George W. Bush administration. Officers in the early days of the war were slow to recognize that they were fighting an insurgency. U.S. troops often alienated the Iraqi people with heavy-handed tactics and struggled to develop effective Iraqi security forces.

Cohen is among those who believe that Iraq was on a “fragile trajectory toward success” before the U.S. withdrawal. In recent days, he said, he has detected “real anger at the Obama administration” among senior members of the military for not pressing the Iraqis harder to accept a long-term U.S. presence.

But he worried that the military’s impulse to blame Iraq’s problems on Obama or Iraqi political leaders would prevent the Army from undertaking a “sober institutional stock-taking” of its own failures.

“Actually, the Army is doing a much worse job of taking a hard look at itself than it did after Vietnam,” Cohen said.

The military’s post-Vietnam narrative, which pinned the blame for its loss on the Johnson administration, largely absolved the Army of its own mistakes during the Vietnam War. This view held for years and eventually gave rise to a muscular U.S. military force that smashed Hussein’s forces in two conflicts but was ill-prepared for long guerrilla wars in Iraq and Afghanistan.

Today, most Iraq war veterans feel tremendous pride in their service, mixed with a deep cynicism regarding the Iraq war’s goals and its outcome. A Washington Post poll of Iraq and Afghanistan veterans taken a few months before the recent chaos found that only 44 percent believed the Iraq war had been worth fighting. Nearly 90 percent, though, said they would volunteer to serve again.

Those somewhat contradictory feelings have grown more intense in recent days. As the president weighed his military options in Iraq, Col. Steve Miska, who spent 40 months in the country, called his brother, who is also a veteran of multiple Iraqi tours. The war had consumed much of the two brothers’ lives since the 2003 invasion. Now the two career soldiers — one an officer, the other a sergeant major —were on the verge of retirement.

“What a mess,” Miska texted his brother as ISIS troops pressed towards Baghdad last week.

“Hopefully all our guys that gave their lives didn’t do it for nothing,” his brother replied.

The two then spoke on the phone. Miska insisted that their service — especially during the 2007 surge — had made a difference in Iraq. At that point in the war, Sunni and Shiite death squads had taken hold of the capital. “I have no doubt that we helped stop a civil war,” Miska recalled telling his brother. “I have no doubt we saved thousands of Iraqi lives.”

Miska returned to Iraq for the last time in 2009 to command a battalion of about 800 soldiers. By then, much of the fighting had subsided. His troops, who occupied a desert base south of Baghdad, were mostly bored. Miska left Iraq that last time hopeful that Iraq’s feuding Sunnis, Shiites and Kurds would take advantage of the period of relative calm to make the kinds of political compromises that would result in a lasting peace.

For him, the current mess in Iraq defies any simple explanation.

“I don’t think the military lost in Iraq,” Miska said. “We created a window of opportunity. It just didn’t break the Iraqis’ way.”