Islamic insurgents fired mortar rounds at the main airport in Mogadishu, the capital of Somalia, as the president was preparing to fly out, an official said.
Nobody was hurt in the attack, said the president's spokesman, Hussein Mohamed Mohamud.
President Abdullahi Yusuf was at the airport but had not yet boarded his plane when the mortar shells landed, Mohamud said. He flew to Ethiopia later in the day.
Yusuf escaped unharmed last week after a similar attack.