In an Oval Office address on Monday that came amid an election-year debate over whether America is safer five years after 9/11, George Bush said: "Whatever mistakes have been made in Iraq, the worst mistake would be to think that if we pulled out, the terrorists would leave us alone.
"The safety of America depends on the outcome of the battle in the streets of Baghdad."
Criticised by some Democrats for not getting bin Laden when there was a chance in late 2001, Bush renewed his pledge to track down the leader of al-Qaeda.
"Osama bin Laden and other terrorists are still in hiding. Our message to them is clear: No matter how long it takes, America will find you, and we will bring you to justice."
Bush spoke a day after The Washington Post reported that the search for bin Laden, believed to be hiding in the mountains along the Afghanistan-Pakistan border, had gone "stone cold" with no credible leads in more than two years.
The September 11 attacks brought Americans together behind their untested president; but many parted ways with him when the Iraq war turned out to be far costlier in lives and money than forecast.
"If we yield Iraq to men like bin Laden, our enemies will be emboldened."
Today, Bush's job approval ratings have only barely climbed out of a deep trough, and he is fighting to keep his Republicans from being defeated in November elections in which Democrats see their best opportunity in years to take control of one or both chambers of the US Congress.
Bush said the war on terrorism was only in its "early hours" and described it as a "struggle for civilisation".
He said: "Our nation has endured trials - and we face a difficult road ahead.
"Winning this war will require the determined efforts of a unified country. So we must put aside our differences, and work together to meet the test that history has given us."
Bush's argument for staying in Iraq amounted to the same theme he has been using on the campaign trail, that it would be wrong to pull out of Iraq before the government in Baghdad is stable, which many Americans increasingly see as a fleeting prospect.
Democrats see the Iraq war as a distraction from the war on terrorism. Some would like a phased redeployment of US troops from Iraq by the year's end, forcing Bush to make his case to Americans weary of the war that the troops must stay.
He said: "If we yield Iraq to men like bin Laden, our enemies will be emboldened. They will gain a new safe haven, and they will use Iraq's resources to fuel their extremist movement. We will not allow this to happen.
"America will stay in the fight."