Al-Shabaab, a Somali militant group aligned with al-Qaida, claimed responsibility for an attack Sunday in Mogadishu. The BBC reported at least 20 people died in attacks on a courthouse and in a car bombing.
Hague said the actions of terrorist groups in Somali are prolonging the suffering of Somalis.
"The U.K. and the international community ... remain committed to helping the people of Somalia achieve peace, security and development," he said in a statement. "Those responsible for terrorist acts should face justice."
Somalia last year made strides in solidifying the authority of the central government in Mogadishu.
Somali Foreign Minister Fawzia Yusuf Adam said in March that political gains were grounds for hope, "but they are precarious and the road to full recovery will be long."
U.S. President Barack Obama last week signed a decree stating that providing military assistance to the Somali government "will strengthen the security of the United States and promote world peace."