At the weekend, flares lit the night sky as US Marines rehearsed the rescue mission. Landing-craft from the six-nation flotilla, which includes the British destroyer Exeter, have been coming and going from the beach. Helicopter gunships and troop-carriers have criss-crossed the cloudless sky like dragonflies while the vanguard of the Marines scurried about in the sand dunes below.
The Marines' mission is to secure the coastal strip containing Mogadishu port and airport while ensuring the speedy evacuation of the remaining peacekeepers.
Yesterday supporters of the faction leader General Mohamed Aideed, in pick-up trucks mounting heavy-calibre machine-guns, converged on the airport approaches, saying that they were under orders to protect the area from bandits.
As dusk fell, a fierce gun battle broke out around the hotel where I was staying. The clash was between renegade elements in the Kilometre 4 area of Mogadishu. Even the call to prayer from the city's mosques did not disrupt the deafening sound of gunfire, which went back and forth. [The window in front of the desk where I was working was hit by a bullet shortly after I filed this report.]
United Nations and US commanders are haunted by memories of their earlier ill-fated mission. As fighting raged and famine stalked the land, Washington led a UN coalition into Somalia at the end of 1992 to protect humanitarian aid deliveries. But the operation degenerated into a conflict with the warlords, particularly with the militia of General Aideed that the Americans tried to destroy. The deaths of dozens of Americans and hundreds of Somalis forced the withdrawal of the UN Unified Task Force last March.
There are few remnants of the Americans' previous incursion: some blasted buildings, a handfull of burnt-out military vehicles, some discreetly hidden graves and the graffiti left by Marines: "I love Kay", "Katya I love you, see you soon", "Teri, I'm coming home".
The Americans are taking no chances this time and will be spending little time on the ground. Once the peace-keepers are withdrawn, they will load up dozens of US tanks, helicopters and armoured vehicles leased to the UN Operation in Somalia (Unosom).
If the evacuation goes smoothly, only about a thousand Marines and a few hundred Italian troops will go ashore. About 200 of the US contingent will carry new non-lethal riot-control weapons, including Stinger hand- grenades, which explode into hard rubber pellets, and machines that spray foam laced with tear-gas.
The Marines are playing down the likelihood of an all-out attack. They are more worried about "spill-over fighting" from looting, expected to break out when they depart.
But the UN has ensured that the pickings will be limited to a few portable huts, some furniture and air-conditioning units. Recently the UN has shipped out $170m (£100m) of equipment for peace-keeping operations in Bosnia and Rwanda.
The last of 2,700 Somali employees have been paid off. Up to $1m a day has been spent by the UN operation, a huge boost to the local economy. Victory Gbeho, UN special envoy to Somalia, admitted UN money kept the civil war going, through taxes imposed by the warlords on the locally recruited workforce.
Lieutenant-General Anthony Zinni, UN force commander, and Mr Gbeho say they have received assurances from General Aideed and his rival, Ali Mahdi, that the international force will not be attacked. The signing of a peace agreement by the two warlords has been greeted as "a positive development" by Mr Gbeho, who insists that, despite the failure of previous initiatives, the prospects for peace in Somalia are good.
Somalia has been without a government since the January 1991 overthrow of the dictatorial president, Siad Barre.
Almost three years have passed since the beginning of the first UN operation in Somalia and nearly two years since Unosom II was launched to protect civilian lives and promote national reconciliation between the warring factions.
The UN has sponsored a police force, judicial system and prison service but once the paymaster has gone, the only hope for law and order lies in the hands of the warlords. Without a government, the danger of renewed conflict is great.
As the last UN personnel pack their bags, gunmen roam the streets. The hospitals have no medicines and public services are non-existent.
This nation of nomadic herdsmen has a phrase to describe a vain, pointless exercise: "Hal bacad lagulisey". The UN operation, some say, was as useful as "milking a camel on to the sand".
Not all is lost. Mogadishu's inhabitants, as they often tell you, are tired of the civil war that has caused so much suffering and destruction. In the past few years they have revived the local economy and business in the marketplace is booming. There is hope that the clans will avert renewed hostilities after the UN's departure.
Although armed militias are still on the streets, the warlords have neither the resources nor the support to wage war with the ferocity of earlier years. Yesterday a pro-Aideed rally drew a crowd of more than a thousand people, who chanted: "Down with the United States". But his Somali National Alliance is a fractured force. However, last night's shooting around my hotel might be the first rumble of thunder before the storm.