Rebels fired mortars near the Somali parliament meeting in Mogadishu on Sunday, killing at least 16 people.
African Union peacekeepers returned fire after the mortar attack, which was blamed on Islamist insurgents.
Lawmakers were meeting in the parliament complex in Mogadishu for the first time since it was renovated.
Inside the chamber, members quarreled with Parliamentary Speaker Sheikh Aden Madobe over the legitimacy of government leaders.
The speaker said members of the parliament had voted no confidence in the government. Madobe told VOA he asked President Sheikh Sharif to name a new prime minister within 30 days.
But lawmakers said they had voted to replace Madobe with a new speaker, and the president and prime minister called for him to resign.
Somalia has not had a stable central government since 1991.
Insurgent groups are fighting to impose a strict form of Islamic law in much of Mogadishu along with large parts of southern and central Somalia.