Somalia's al-Shabab ambush President Ahmed's convoy
Somalia's President Sheikh Sharif Sheikh Ahmed has escaped unharmed from an Islamist militant attack after a visit to a newly captured town.
His armoured convoy was ambushed on a road between Afgoye and the capital, Mogadishu, which African Union troops said they had made secure on Monday.
Officials said the interim president, who was making a rare road trip out of the capital, has returned safely.
Al-Shabab, which joined al-Qaeda this year, said it was behind the attack.
Afgoye, 30km (18 miles) north-west of Mogadishu, was a major stronghold of the al-Shabab group, giving their fighters easy access to the capital.Attackers repulsed
At least one Somali government soldier was killed and four were wounded when al-Shabab gunmen opened fire as President Ahmed drove down the road between Afgoye and Mogadishu.
Known as the Afgoye corridor, the road is a strategic stretch of land and home to up to 400,000 people who have fled years of fighting and are now living in makeshift camp, the world's largest concentration of displaced people.
The attack is reported to have occurred on the outskirts of Elasha town, which is midway between Mogadishu and the former al-Shabab stronghold of Afgoye, which was captured by interim government forces and African Union troops on Friday.
AU spokesman Lt Col Paddy Ankunda said Somalia and African Union soldiers opened fired and repulsed the attackers.
"We disrupted it as soon as they fired small guns from afar," he told Reuters news agency.
Correspondents say the president rarely travels by road outside the capital - and this was his first trip to Afgoye since its capture.
The loss of the town - which lies on a strategic crossroads for routes to the north, west and south of Somalia - was a major blow to al-Shabab, which used it to launch suicide attacks on Mogadishu.
Analysts say al-Shabab militants are likely to be hiding in the surrounding villages, bush and farm lands - and the group says its retreat from Afgoye was tactical.
A major conference on Somalia is to be held on Thursday in Istanbul - Turkey has been leading recent international efforts to restore peace and stability to Somalia.
Last week, leaders of disparate Somali factions agreed to a timetable that will elect a new president by 20 August, ending the transition period of the UN-backed interim government.
The Horn of Africa nation has been without an effective central government since 1991 and has been racked by fighting ever since - a situation that has allowed piracy and lawlessness to flourish.