Somali prosecutor Ahmed Malim Sheik Nur was killed last week by Islamic militants. Al-Shabaab, a militant group with ties to al-Qaida, claimed responsibility for bombing courthouse in Mogadishu this month.
Somalia last year established a central government for the first time since the 1990s. Ashton expressed her condolences for the most recent attack.
"(She) utterly condemns such attacks, which in no way should diminish the remarkable progress in the country," a statement from her office read.
British Foreign Secretary William Hague last week opened the British Embassy in Somalia for the first time since 1991. Hague said the country has witnessed "a dramatic shift" but had "huge challenges" ahead.
Somali Ambassador to the United Nations Elmi Ahmed Duale told the Security Council that Somalia has made significant progress but wasn't "at a place where we can see the light at the end of the tunnel."