UNITED NATIONS — Moving to better protect Somalia's weak, U.N.-backed government from armed opposition groups, the Security Council unanimously agreed Wednesday to increase the peacekeeping force there by 50 percent, from 8,000 to 12,000 troops.

Council members also authorized the African Union to extend its deployment of the peacekeeping force known as AMISOM through Sept. 30, 2011, calling the move "vital for the long-term stability of Somalia."

Uganda said it would contribute the additional 4,000 troops.

The resolution approved by council members said the extended deployment and the troop increase are necessary to support Somalia's so-called Transitional Federal Government and civilians from attacks by al-Shabab and other opposition groups.

Al-Shabab and the other largest armed group in the country, Hizbul Islam, announced in recent days they would drop their feud and merge forces to concentrate on fighting the Mogadishu-based government and the African Union troops who protect it.

Al-Shabab has publicly pledged allegiance to Osama bin Laden and counts several hundred foreign fighters in its ranks. Considered Somalia's most dangerous armed group, al-Shabab practices a harsh, conservative brand of Islam that bans television and movies. Its punishments include the chopping off of hands of thieves and death by stoning of adulterers.

The council also repeated its worries about the worsening humanitarian situation in Somalia, and condemned attacks by armed groups on aid workers and their obstruction of aid shipments.

It also touched on the problem of piracy off Somalia's coast, saying countries must work together to provide solutions, and repeated its demand that all armed groups in the country stop recruiting child soldiers.