He said the bomb had been made from a landmine and that all the casualties were civilian.
Mohamed Osman, a deputy mayor who was not in the convoy, said: "Fortunately, the bomb exploded before his vehicle passed.
"No one was hurt in the convoy. The man who detonated the bomb was captured as he was trying to flee. He was killed."
Osman said that another man who had provided shelter for the bomber to set off his explosive was arrested.
There has been a respite in fighting in Mogadishu since Ali Mohamed Gedi, the interim prime minister, declared victory over members of the Union of Islamic Courts following battles in March and April that killed at least 1,300 people and flattened neighbourhoods.
But there have been increasing cases of attacks using Iraqi-style tactics - including roadside bombs and assassinations.
The interim government, backed by Ethiopian troops, tanks and warplanes, routed the courts' fighters from Mogadishu and southern Somalia in a short war over the New Year.