President George W Bush has said victory in Iraq is essential to the US winning the "war on terror" against the Islamist groups ranged against it.
The US would not leave Iraq until victory was achieved, he told military veterans in Salt Lake City, Utah.
And he warned Iran of "consequences" if it continued to defy the international community over its nuclear programme.
The speech is one of a series in which Mr Bush is defending his security strategy as mid-term polls approach.
"The war we fight today is more than a military conflict," Mr Bush said. "It is the decisive ideological struggle of the 21st Century."
'Twisted view of Islam'
He said those who brought down the World Trade Center in New York five years ago were united with car bombers in Baghdad, Hezbollah militants who shot rockets into Israel, and terrorists who had recently attempted to bring down flights between Britain and the US.
"Despite their differences, these groups form the outline of a single movement, a worldwide network of radicals that use terror to kill those who stand in the way of their totalitarian ideology," he said.
"And the unifying feature of this movement, the link that spans sectarian divisions and local grievances, is the rigid conviction that free societies are a threat to their twisted view of Islam."
Mr Bush said agreeing to calls from within the US to bring the troops home would create a disaster in the Middle East.
"Many of these folks are sincere and they're patriotic but they... could not be more wrong," he said.
"If America were to pull out before Iraq could defend itself, the consequences would be absolutely predictable, and absolutely disastrous.
"We would be handing Iraq over to our worst enemies - Saddam's former henchmen, armed groups with ties to Iran, and al-Qaeda terrorists from all over the world who would suddenly have a base of operations far more valuable than Afghanistan under the Taleban."
He added: "This war will be difficult, this war will be long - and this war will end in the defeat of the terrorists."
Warning to Iran
The president also condemned the government of Iran, which he said was supporting terrorist groups like Hezbollah and defying the international community with its nuclear activities.
"It is time for Iran to make a choice. We've made our choice - we will continue to work closely with our allies to make a diplomatic solution, but there must be consequences for Iran's defiance and we must not allow Iran to develop a nuclear weapon," he said.
Mr Bush is to make several more speeches on Iraq and security in the next two weeks.
Correspondents say his Republican Party fears unease over the Iraq war could damage its standing in mid-term polls on 7 November.