Unidentified gunmen shot and killed the officer in charge of the UN Development Programme (UNDP) office in Mogadishu, on 6 July, according to UN officials.
Osman Ali Ahmed, 48, was on his way home after evening prayers with his eight-year-old son and a cousin, according to a friend who was also at the mosque.
"Three gunmen were waiting outside the Kashka Mosque in Bulo Hubey [south Mogadishu] and shot him at point blank range; his cousin was injured in the leg but his boy is fine."
He said Ahmed died as he was being rushed to hospital at about 7.40pm local time.
Abdi Haji Gobdon, the government spokesman, told IRIN the government condemned the "senseless murder".
"We condemn it in the strongest possible terms," he said. "The security agencies will do everything they can to track down the culprits and bring them to justice."
He said those carrying out the killings and kidnappings of aid workers "were people who wanted to see their fellow Somalis die. How can you target people who only want to help? What possible motive could they have in killing Osman [Ahmed]?"
Ahmed's murder is the latest in a spate of killings and abductions of aid and civil society workers in Mogadishu.
On 30 June, four aid workers with the charity Water For Life (WFL), were ambushed on the road linking Afgoye to Mogadishu.
On 21 June, the head of the UN Refugee Agency (UNHCR) in Mogadishu, Hassan Mohamed Ali, better known as "Keynaan", was abducted from his home by unknown armed men. On 22 June, a peace activist was killed in Beletweyne town in Hiiraan region, central Somalia. Mohamed Hassan Kulmiye, who was working at the Centre for Research and Development (CRD), a local think-tank involved in peace initiatives, was shot by unidentified gunmen.
A few days earlier, an employee of CARE International, whose name the agency declined to reveal, was abducted near El-Dheer town in Galgadud region. He was the second CARE staff member to be abducted in six weeks.
A civil society source told IRIN recently: "It seems there is a concerted campaign against aid workers and civil society. We don't know who is behind it or why."
He added that there was "a level of fear never seen before among aid workers and civil society, forcing many to curtail their work or abandon it altogether.
"If this continues it will be impossible to find anyone willing to work for aid agencies, and that will only add to the suffering of the Somali people," he told IRIN on 7 July.
Aid workers estimate 2.6 million Somalis need assistance - a number that is expected to reach 3.5 million by year-end if the humanitarian situation does not improve, according to the UN.
UNDP condemned the targeted killing of Ahmed. In a statement the agency said that "Ahmed was a long-serving UNDP staff member who had dedicated his life to the betterment of his country. A highly professional and dedicated man, he will be sorely missed by all his colleagues at UNDP."
The agency added: "We extend our deepest and most sincere condolences to his wife and family."
Ahmed, who was buried on 7 July, leaves two widows and five children.