The attack undermines a UN-mediated cease-fire signed last week between the government and opposition groups as the country's humanitarian crisis worsens.
Monday, the government and an opposition bloc signed a UN-brokered peace deal. But Tuesday, Islamist hard-liners said they would continue to fight.
Mogadishu's recent outbreak of violence appeared linked to a May airstrike that killed Hashi Aden Ayro, a Somali Islamist leader who the US says has links to Al Qaeda.
The USS Fort McHenry is traveling the coast – training soldiers and providing relief.
On a three-day trip, President Nicolas Sarkozy also inked economic and nuclear deals with Gulf states.