A senior serving US army officer has launched a scathing attack on the US military leadership in Iraq.
Lieutenant Colonel Paul Yingling said US generals had failed to prepare their troops properly and had misled Congress about the resources needed for the war.
Writing in the Armed Forces Journal, he said the US had repeated the mistakes of Vietnam and so faced defeat in Iraq.
Such criticism from a serving officer is rare, analysts say, although several retired generals have spoken out.
Lt Col Yingling's remarks come a day after the top US commander in Iraq, General David Petraeus, described the situation in Iraq as "exceedingly complex and very tough".
Acknowledging that the US effort "clearly is going to require an enormous commitment over time", he asked Congress to give the new "surge" strategy, of pouring more troops into Baghdad, time to take effect.
Congress, meanwhile, passed a war funding bill setting a timetable for the withdrawal of US combat troops from Iraq, despite the threat of a veto by President George W Bush.
Lt Col Yingling, who is deputy commander of the 3rd Armoured Cavalry Regiment and has served two tours in Iraq, said the military leadership had entirely failed to grasp what would be needed for success in Iraq.
"For reasons that are not yet clear, America's general officer corps underestimated the strength of the enemy, overestimated the capabilities of Iraq's government and security forces, and failed to provide Congress with an accurate assessment of the security conditions in Iraq," he wrote.
The generals had gone into Iraq in 2003 with too few soldiers and no coherent plan for post-war stabilisation, having spent a decade "preparing to fight the wrong war", he said.
"The intellectual and moral failures common to America's general officer corps in Vietnam and Iraq constitute a crisis in American generalship."
Lt Col Yingling has not singled out any individual for criticism but has urged Congress to take a greater role in monitoring officers' performance and holding them accountable.
He said the US military had done too little to prepare for the kind of intense insurgencies they had encountered in Iraq and Afghanistan, and had then tackled them in the wrong way.
"Given the lack of troop strength, not even the most brilliant general could have devised the ways necessary to stabilise post-Saddam Iraq," he wrote.
"In 2007, Iraq's grave and deteriorating condition offers diminishing hope for an American victory and portends risk of an even wider and more destructive regional war."
US military spokesman Lt Col Christopher Garver in Iraq told the Associated Press news agency that Lt Col Yingling had written expressing "his personal opinions".
"We of Multinational Force Iraq are focused on executing the mission at hand," he said.