He said the fighters were manning a checkpoint at Galgalato, 25km north of the city centre.
The attack occurred on the last day of a three-day deadline for residents of the coastal capital to hand in their guns or be disarmed by force.
Ahmed Hassan, a Mogadishu resident, said: "I won't do it. For 16 years this country has been in chaos. It would be suicide."
The country's police commander, who only has about 1,000 officers under his control, admits he is outgunned.
"The UIC may have brought peace for a while but what would have been the cost?"
Abluth, Portland, US
Send us your views
"I cannot say there is a viable police operation in Mogadishu," Ali Mohamed Hassan Loyan said.
Meanwhile, the Bakaara market in central Mogadishu is doing brisk business in weapons, with rickety wooden stands selling Kalashnikov rifles, machine guns and hand grenades.
Only a handful of people have so far heeded the prime minister’s demand and turned in any weapons. Twenty freelance fighters turned in 20 small guns and a "technical" - a truck mounted with machine guns on Wednesday.
Somalia's interim government issued the order after its forces, backed by troops, tanks and warplanes from neighbouring Ethiopia, routed Union of Islamic Courts (UIC) fighters, who had brought some stability to much of the south during its six-month rule.
Many Somalis say they resent the interim government as an Ethiopian puppet that is virtually powerless on its own.
Residents say they have also been scared by the reappearance of fighters loyal to a host of regional commanders chased out of Mogadishu by the Islamic Courts in June.
Within hours of the Islamic Courts fleeing the city a week ago, many armed groups had taken up positions at checkpoints where they used to rob, rape and murder civilians.
Analysts say the rapid return of regional commanders shows how easily the city could slide back into the anarchy it has suffered since Mohamed Siad Barre was overthrown in 1991.
The government is trying to install itself in the capital, after breaking out from the provincial outpost of Baidoa, which had been threatened by the Islamic Courts.
After leaving its final stronghold in southern Somalia on Monday, UIC rejected an amnesty offer and vowed to fight on using guerrilla tactics.
Government troops backed by Ethiopian fighter jets and helicopter gunships have been pursuing Islamic Courts fighters in the scrubland between Kismayu and the Kenyan border.
|The UN says 4,000 Somalis fled to Kenya in the|
early days of fighting [AFP]
The United States, trying to block the escape of UIC leaders and foreign fighters by sea, has deployed warships from a counter-terrorism force off the Somalia's coast.
The UN High Commissioner for Refugees (UNHCR) says 4,000 Somalis crossed the border during the early days of fighting.
Kenya has since intensified its security measures on the border and reinforced its troops to guard against any spill-over of the fighting.
As a result, thousands of people are stranded in the Somali town of Dhobley waiting to go through security screening and cross into Kenya.