By James Landale
Deputy political editor, BBC News, in Afghanistan
Mr Brown said the next few months of the campaign would be "critical"
It is one thing to visit. It is another to stay over.
But this is exactly what Gordon Brown has done in Afghanistan, the first prime minister since World War II to spend a night in a combat zone.
He bunked down in a basic hut with limited heating and shared latrine in Kandahar airbase, which comes under rocket fire at least once a week. "No frills," was how one officer described it. "One star at most," said another.
This was in part down to logistics: it allowed Mr Brown to fit in more meetings and visits.
But it also, he said, allowed him the chance to get a small glimpse of how servicemen live out here in these dusty, concrete-clad, container-strewn military bases.
His message was simple. For all the controversy over casualties and equipment, he believes progress is being made.
He wants the war to be judged by what's going on, on the ground, and not just by the casualties and ceremonies at Wootton Bassett.
At the Afghan army's Shorabac base in Helmand, he witnessed what he believes is the key to potential success in Afghanistan - the training of local troops who can eventually take control and allow British forces home.
He saw in particular Afghan troops teaching other local forces how to clear improvised explosive devices (IEDs), all under the watchful gaze of their British trainers.
The talk is of thousands of new recruits passing through here in the coming months. What is less clear is how many will stay the course with desertion rates believed to be around 15%.
So for now the prime minister will keep British forces here to support President Karzai's government and fight the Taliban. It was, he said, a mission the British public understood, despite recent polls pointing in the other direction.
In Kandahar Mr Brown was shown new equipment that he hopes will keep British forces safer and counter allegations that they have been under resourced - such as new mine-resistant vehicles and unmanned surveillance aircraft designed to protect troops from IEDs.
He told us that almost 1,500 IEDs had been destroyed by British forces in the last six months.
As for President Karzai, well, he and Mr Brown were falling over themselves to praise each other after some clearly frank exchanges in recent weeks.
The prime minister congratulated President Karzai for providing more troops but pointedly said his efforts to tackle corruption would be judged by results.
On that, President Karzai promised to do more and he expressed his sorrow at the death of the 100th British serviceman this year.
Mr Brown admitted it had been a difficult year for British troops but said he was confident the new equipment and extra US troops would make a difference.
He wished the troops happy Christmas - but he couldn't promise it would be their last here.