A bomb blast Thursday killed two Somali policemen and four refugees close to a camp for displaced people in the capital, Mogadishu, the African Union's peacekeeping force in Somalia said.

Nur Hayr, a senior police officer, said the explosion happened in the capital's Wadajir district. It appeared to target a police checkpoint set back from the densely packed settlement of crude shelters.

The bomb was planted under an acacia tree where the camp leaders and police always sit. The tree is near the camp leaders' office, Hayr said.

Ndayiragije Come, spokesman for Burundi's peacekeeping contingent, told Reuters: The blast killed six people not so far from our base today.

A second bomb that failed to detonated was found nearby.

Bomb blasts and suicide attacks have been on the rise in the coastal city since August when the al Shabaab rebel group pulled most of its fighters out of the city.

Thursday's attack, which happened after U.N. officials and foreign journalists had watched food being distributed in the camp, underlined the dangers that tens of thousands of Somalis displaced by war and famine face each day.

Earlier, a hand grenade was hurled at a U.N. compound in Mogadishu. The grenade, which exploded, fell short of the compound and there were no casualties.

(Reporting by Abdi Sheikh and Feisal Omar; Editing by Richard Lough)