Tony Blair, in a speech to the Australian parliament on Monday, also said that there was a danger of the United States retreating into isolationism.
Blair made his case for the West to get involved in a broad range of issues, not just on the security front, in its struggle against Islamist militants.
Australia and Britain both have troops in Iraq and Afghanistan.
Blair, America's closest ally in Iraq, acknowledged that the war there had divided opinion in Australia and in Britain, but he portrayed Iraq and Afghanistan as critical battlegrounds.
"Every reactionary element is lined up to fight us," he said. "They know if they lose, a message is sent out across the Muslim world that strikes at the heart of their ideology.
"Every reactionary element is lined up to fight us. They know if they lose, a message is sent out across the Muslim world that strikes at the heart of their ideology"
British prime minister
"We must not hesitate in the face of a battle utterly decisive as to whether the values we believe in triumph or fail ... If the going is tough - we tough it out. This is not a time to walk away. This is a time for courage to see it through."
Blair said that while the battle over values was most fierce in Iraq and Afghanistan, Western countries also had to get involved elsewhere and on a range of other issues.
"Wherever people live in fear, with no prospect of advance, we should be on their side ... whether in Sudan, Zimbabwe, Burma [Myanmar], North Korea," he said.
He called for an "active foreign policy of engagement" by a strong alliance, including the United States.
Calling the anti-American feeling seen in parts of world politics "madness", Blair said: "The danger with America today is not that they are too much involved. The danger is they decide to pull up the drawbridge and disengage. We need them involved."
A man wearing a Blair mask at a
protest outside parliament
Blair also spoke on the Middle East conflict, saying "we must redouble our efforts to find a way to the only solution that works: a secure state of Israel and a viable, independent Palestinian state".
And he called for action to combat conflict, famine and disease in Africa, a focus on the threat of climate change, and voiced support for a new world trade liberalisation agreement.
Outside parliament, about 100 anti-Iraq war protesters blew whistles and trumpets to try to disrupt the visit, but they were kept well away.
There was no repetition of the heckling by members of partliament that greeted George Bush, the US president, when he spoke in Canberra in 2003 and defended the invasion of Iraq.