Gordon Brown has said long-term success in the war on terror will require victory in the "battle of ideas".
Mr Brown is the favourite to replace Tony Blair as Prime Minister
He said people who are "defenders of democracy" should unite, and insisted that success would not be possible through purely military means.
The Chancellor was speaking at the Cheltenham Literary Festival to promote a book of his collected speeches.
Asked about his view on US-UK relations, Mr Brown said he supported having a British foreign policy.
'Hearts and minds'
Mr Brown said: "I don't think we can win this through military means in the long run. I think we have got to win this by hearts and minds."
"I think, quite passionately, we need unity from people who are defenders of democracy, people who are to counteract a possibly generation-long threat from people who are prepared to cause carnage."
He said the 'battle of ideas" was about democracy, fairness and justice and warned that no good would come of divisions between America and Europe.
Asked whether foreign policy under a possible Brown government would be more independent from the United States, he replied: "I think our foreign policy must always be British foreign policy."