By Mark Urban
Diplomatic editor, BBC Newsnight
Most of the British forces in Iraq are based in Basra
In a district like al-Hadi, a slum in northern Basra, the British Army is trying to set the conditions for its withdrawal from this city.
When we visited a school there last week, soldiers were hard at work with paint brushes, drills and diggers giving the place a makeover.
The questions being asked by the chief of the general staff back in London, are the same that prompted commanders in the field to launch Operation Sinbad at the end of September.
How long should British troops remain on the streets?
Do their operations, particularly arresting Iraqi militants, do more harm than good?
And how can Iraqi public consent be maintained while the soldiers do the minimum necessary to hand over to their government?
In trying to answer those questions, the British have come up with a package of measures.
When the Warrior fighting vehicles roar away, Iraqi contractors move in
Operation Sinbad "pulses" - in which each of the city's 18 districts is flooded in turn with troops so that work can be done to schools, utilities or police stations - are the first step.
When the Warrior fighting vehicles roar away, Iraqi contractors then move in to do longer term infrastructure work.
The most ambitious scheme involves planting hundreds of acres of date palms on the eastern bank of the Shatt al-Arab waterway.
Most of the money for these projects is American.
While the soldiers and contractors try to impress local people with all this work, they are also taking steps to purge the police of the corrupt and murderous elements which have made it notorious.
And it is in their attempts to deal with the worst police, and the most violent leaders of the radical Shia militias, that the British Army has really got its work cut out.
In recent months the British have been kicking down doors as well as painting them.
Troops face growing threats across the spectrum of militia activities
"Strike Ops" have detained several prominent Baswaris (Basra citizens) who - commanders insist - have British blood on their hands.
These raids, and the sense that a handover to Iraqi control may well happen in the coming months, have caused a steep rise in attacks on British forces.
Maj Gen Ali Hammadi, the Iraqi security co-ordinator for the city, told us violence would drop by 80% if British troops stopped their arrest operations.
Foreign troops now face growing threats across the spectrum of militia activities.
Helicopters only fly into central Basra at night since one was shot down in May.
Downtown bases are now being rocketed or mortared almost every night.
And more roadside bombs are being detonated.
Troops come under attack both on the streets and inside their base
At night, elements of the Mehdi Army militia have fought running gun battles with Multi-National Forces - in one case we witnessed last week, a Danish soldier was killed,
British troops fired 5,000 rounds, calling in Challenger tanks and fighter cover.
Where is all this leading? Probably to a crunch or tipping point in 2007.
Maj Gen Hammadi argues the Iraqis will be ready to take over security in Basra when Operation Sinbad ends in January.
British commanders are far less optimistic, believing that it will take longer to purge the police in particular of its rogue elements.
Even so, these days British officers talk about achieving good results rather than perfect ones, and few believe they will still be in charge of security in Iraq's second city by this time next year.
The British have been kicking down doors as well as painting them
When the day comes for "Pic" - Provincial Iraqi Control in Army-speak - questions will inevitably be asked about whether British troops should remain in Iraq at all.
Maj Gen Richard Shirreff, the British officer commanding Multi National Division South East, told us that they will have to be there, "until our major coalition partner, our principal ally, the Americans, declare game over in the centre in Baghdad".
Current plans suggest the British will draw down, closing three of their bases and cutting strength by about 3,000 of the current 7,000 troops.
The remainder would be concentrated around the airport, rarely venture into the city and would be there to offer support to the Iraqi security forces in a crisis.
The Shia militias will hope to upset these calculations so that they might claim credit for driving the British from the city and in Basra today, there is a definite sense that the end game has begun.