In addition to the deaths on Tuesday, at least six people were wounded in the battles, the first clashes around the city since Islamists seized control of Mogadishu this month from a regional commanders alliance thought to be backed by the United States, the sources said.
The regional commander whose positions at Lafole village just south of Mogadishu were seized in the fighting, Abdi Hassan Qeybdid, said: "Two of the dead are members of the Somali police and the other three are civilians."
He said the attacks were carried out by gunmen loyal to the city's Islamic Courts Union, which has cemented its hold on the city since routing the commanders on June 5 after four months of fighting that killed more than 360.
A founding member of the now-defunct Alliance for the Restoration of Peace and Counter-Terrorism (ARPCT), Qeybdid, said: "We thought the courts were interested in peace, but now I have come to know that this is not the case.
"The courts are more interested in the continuation of violence," he said.
An official for the courts group rejected Qeybdid's assertions about violence, but confirmed that fighters loyal to Mogadishu's sharia law courts had seized the two positions as part of an attempt to pacify the city.
"This is part of our effort to make Somalia a peaceful place, and Qeybdid must surrender his weapons to the courts," the official told AFP on condition of anonymity.
"This is part of our effort to make Somalia a peaceful place and Qeybdid must surrender his weapons to the courts"
An Islamic courts announcement read over local radio stations said the posts had been taken because Qeybdid had refused to fully comply with their demands for capitulation.
Qeybdid is one of two ARPCT members to have stayed in Mogadishu since the Islamists took the city.
Although he has renounced the alliance, he has refused to co-operate with the courts group.
The other, Omar Mohamud Mohamed, the former minister of religious affairs in Somalia's transitional government, has pledged to work with the courts group.
Washington is thought to have supported the regional commanders alliance in a covert operation as part of its larger so-called war on terrorism because of allegations that the courts are harbouring "extremists", including members of Osama bin Laden's al-Qaeda network.
On Monday, Shaikh Hassan Dahir Aweys, the new supreme leader of the courts, a cleric designated a terrorist by the United States, pledged that sharia law would be imposed throughout the country.
"We must follow the rule of law as laid down by Allah," he told AFP in an interview, rejecting the US terrorist designation as "misplaced" and a "distortion of the truth."
Aweys' selection at the weekend to replace a moderate as the courts' top official has fuelled concern about a Taliban-like takeover of Somalia.
Washington on Monday ruled out any contact with Aweys, but left the door open to contact with other members of the courts.
Sean McCormack, the US state department spokesman, said that "certainly, of course, we're not going to work with somebody like that."
"And of course, we would be troubled if this is an indicator of the direction that this group would go in."