President George W Bush has said a lesson from the Vietnam War for the US is that it must be patient in Iraq.
Mr Bush is the second US president to visit Vietnam after the war
"We'll succeed unless we quit," he said on a visit to Vietnam, where the US lost its bloody war against communists.
His comments come 10 days after the Republican defeat in mid-term polls in which dissatisfaction on Iraq was key.
Senior Democrats have called for a phased pullout of US troops, but the White House has rejected a firm timetable for such a move.
A bipartisan panel charged by Congress to review US policy in Iraq is due to deliver its findings by the end of the year.
Mr Bush is only the second US president to visit Vietnam since the conflict ended in 1975, with the fall of Saigon.
Asked if the US defeat in Vietnam held lessons for the situation in Iraq, Mr Bush answered: "We tend to want there to be instant
success in the world, and the task in Iraq is going to take a
"It's just going to take a long period of time for the ideology that is hopeful - and that is an ideology of freedom - to overcome an ideology of hate," he said in Hanoi, where he will attend the Asia-Pacific Economic Co-operation (Apec) summit.
"We'll succeed," he added, "unless we quit."
Last month Mr Bush accepted that the surge in violence in Iraq could be equivalent to the US's traumatic experience in Vietnam, where 58,000 Americans died.
He said it could be right to compare Iraq's situation to the 1968 Tet offensive, widely seen as a key turning point in the conflict.
Militarily, the assault failed but it was a huge psychological blow for the Americans and their allies, and eroded political support for the then president, Lyndon Johnson.
But Mr Bush denied that the rising number of Iraqi and US military deaths meant the Iraq campaign was failing.
In October, at least 105 soldiers were killed, the fourth highest monthly toll since US forces overthrew Saddam Hussein, and the worst for US casualties in nearly two years.
More than 2,800 US troops have died in Iraq since the US-led invasion in 2003.
Mr Bush's trip to Asia comes amid a raging debate in the US over his Iraq policy.
US troops are more exposed as they try to tackle sectarian strife
Nancy Pelosi, the Democrat set to be the next speaker of the House of Representatives, has called for a change of strategy, describing the current policy as a "catastrophic path".
The Iraq Study Group, asked by Congress to examine the effectiveness of policy in Iraq, reportedly thinks that "staying the course" is an untenable long-term strategy.
It is said to have been looking at two options, both of which would amount to a reversal of the Bush administration's stance.
One is the phased withdrawal of US troops, and the other is to increase contact with Syria and Iran to help stop the fighting.
Meanwhile, President Bush's National Security Adviser, Stephen Hadley, has confirmed that he is carrying out a review of US policy in Iraq for the White House.