By Caroline Wyatt
Defence correspondent, BBC News
Gordon Brown tried to reassure the British public the mission can succeed
Gordon Brown's speech is a clear attempt to rally public support behind the increasingly difficult mission in Afghanistan, in a week in which seven more British soldiers have lost their lives and the UN has described the security situation as the worst since 2001.
Cracks are appearing in the political consensus behind the military campaign, as public support diminishes.
The prime minister - and commanders on the ground - are well aware that the counter-insurgency campaign against the Taliban and their allies will be won or lost as much in the UK as in the deserts and green zone of Helmand.
At the moment, the Taliban are winning the battle of wills by hitting at Western resolve with a series of high-profile attacks on Western troops.
The deaths this week of five British soldiers at the hands of an Afghan policeman have made more people in the UK question whether the campaign and the sacrifices are worth it, and also whether the mission can succeed.
Gordon Brown sought to reassure the nation that they are, and that it can.
However, a key part of the ultimate strategy is to train Afghans to ensure their own security, so they can keep al-Qaeda and the Taliban out without Western help.
But if the Afghan police force in particular cannot be trusted, that will make it harder to succeed.
Talk of failure
Nato governments are well aware that one central element for success in this campaign is also one of its weakest links - the Afghan government, which is perceived by many of its own people to be both corrupt and ineffective.
Gordon Brown was keen to stress that President Karzai must do better to tackle corruption and a lack of good governance.
The death of five UK soldiers has made people question the campaign
Yet question marks remain over whether any central government in Afghanistan can ever hold real sway in a country that has traditionally been governed locally and along tribal lines.
In a phrase that may dismay military commanders, the prime minister also said of the international coalition that "in the end we will succeed or fail together".
Talk of failure is not something commanders or troops on the ground want to hear - believing that now is the moment for strong political leadership and a determined display of the will to win, backed by the right resources and a clear focus.
Gordon Brown's speech may also have been aimed at Washington.
The increasing insecurity across Afghanistan, despite the presence of more than 68,000 foreign troops, has highlighted the urgent need for a clear and unified strategy for the 40 or so nations taking part in the Nato-led military campaign - a lead that only America can realistically give.
However, Nato forces are waiting with increasing impatience for a decision from the White House on troop levels and strategy.
The time President Obama has spent discussing and debating the report from Nato commander General Stanley McChrystal has been perceived by many as a sign of indecision, which is damaging the campaign on the ground with every passing week as it sends out a message of a lack of resolve.
Military commanders have also been frustrated that the potential cost of failure in Afghanistan has not been spelt out clearly enough to the public.
And there are also fears that the ever louder discussion among politicians and the public of an exit strategy and troop withdrawals will send a clear signal to the Taliban and the Afghan people that Western forces will not be there for much longer, so co-operating with them may be a risk that is simply not worth taking.