Mogadishu - Somali President Hassan Sheikh Mohamud escaped unhurt Tuesday from an ambush on his heavily armoured convoy claimed by al-Qaeda linked Islamists, the latest attack targeting the internationally backed leader.
Al-Shabaab gunmen claimed to have ambushed the convoy as it travelled to the port of Merka south of the capital and boasted of destroying vehicles with rocket-propelled grenades.
But officials said that the attack had failed and all in the presidential entourage were 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," said Somali army official Mohamed Qorey, speaking by telephone from Merka.
The president was travelling in an armoured convoy from the 17 700-strong African Union force (Amisom) that fights alongside the Somali army against Al-Shabaab gunmen.
"We ambushed a convoy that was escorting the self-appointed Somali president," Al-Shabaab spokesperson Abdulaziz Abu Musab told AFP.
The attack took place near the small settlement of Buffow, close to Merka, a former Al-Shabaab stronghold captured one year ago around 100km 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 played down the attacks saying it had 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, a resident of Merka.
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 setbacks in recent months, including a string of Al-Shabaab 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.
Al-Shabaab fighters in May 2012 ambushed the convoy of Mohamud's predecessor, Sheikh Sharif Sheikh Ahmed, but the president escaped unharmed.
More recently, Al-Shabaab fighters have carried out a series of bombings, attacks and killings aimed at overthrowing the government.
UN Monitoring Group reports in July estimated the Al-Shabaab are still some 5,000 strong, and said they remain the "principal threat to peace and security to Somalia".
In June, Al-Shabaab suicide commandos carried out a brazen daylight attack on a fortified United Nations compound, and in July a suicide car bomber attacked a Turkish embassy complex in the city.
Last month Doctors Without Borders - an aid agency that has earned a reputation for working in the toughest of conditions -- closed all its operations in the war-torn country, warning of growing insecurity.