Somali President Hassan Sheikh Mohamud has escaped unhurt from an ambush on his heavily armoured convoy claimed by al-Qaeda-linked Islamists.
Shabab gunmen say they attacked the convoy on its way to the port of Merka south of the capital, and are boasting of destroying vehicles with rocket-propelled grenades.
But according to officials the assault failed and all in the presidential entourage are safe.
"Gunmen tried to disrupt the president's trip ... but I can confirm the president and his delegation are well and reached their final destination Merka to have meetings with local community," Somali army official Mohamed Qorey said on Tuesday.
The president was travelling in an armoured convoy from the 17,700-strong African Union force (AMISOM) that fights alongside the Somali army against Shabab gunmen.
"We ambushed a convoy that was escorting the self-appointed Somali president," Shabab spokesman Abdulaziz Abu Musab told AFP.
The attack happened near the small settlement of Buffow, close to Merka, a former Shabab stronghold captured one year ago around 100 kilometres south of the capital.
"The presidential convoy was attacked but they have continued after about 15 minutes of heavy gunfire," said Ibrahim Adan, a resident of Buffow.
Diplomatic sources are playing down the incident saying it consisted of little more than a roadside bomb.
Residents in Merka said Mohamud appeared in the port, greeting officials and residents as he toured the town.
"He was fine and well, meeting the people who had come to see him," said Nasir Abdirahmam.
Somalia's weak central government, selected in a UN-backed process in August 2012, has made some progress in Mogadishu but has little concrete influence outside the capital.
The government was the first to be given global recognition since the collapse of Somalia's hardline regime in 1991.
But the authorities have been dealt a number of recent setbacks including a string of Shabab attacks, accusations of rape against the army and AU soldiers and a pull-out by aid workers because of a wave of kidnappings and killings.