Somali insurgents mounted an attack on a base where US Special Forces train Somali commandos, while an Italian military convoy was hit in a separate blast in Mogadishu.
No casualties were reported in either attack, US and Italian officials said.
Twin vehicle-borne bombs at the Baledogle base, where Somali forces and Ugandan peacekeepers are housed, were followed by small arms fire, a security source and Somali police said.
“Two suicide car bombs tried to attack Baledogle airport but detonated outside the airport gate,” police Major Abdullahi Nur told Reuters.
The al Qaeda-linked group al Shabaab said it carried out the attack.
Baledogle is west of Mogadishu. Insurgents attacked the base in February using mortars, but caused no casualties.
“The security forces stopped this ultimately failed attack due to their alertness and swift response, not allowing attackers to breach the base’s outer defensive perimeters,” the US embassy said in a statement.
The US military said it and partner forces killed 10 militants and destroyed a vehicle after the attack.
Somali state news agency SONNA reported all the militants in the assault were killed.
“In response to this attack and in self-defence, US Africa Command conducted two airstrikes and used small arms fire targeting al Shabaab terrorists,” a US military statement said.
No US or partner force members were injured in the al Shabaab attack.
The attack showed al Shabaab maintains a good intelligence network and can mount complex operations, said Hussein Sheikh-Ali, a former national security adviser and founder of Mogadishu-based security think-tank the Hiraal Institute.
The attack hit part of the base housing US Special Forces, who supervise Somali forces on operations, he said.
“It implies they have a high intelligence and a degree of capability to get close to that place,” he told Reuters.
The base is also used to mount drone attacks.
Monday’s attacks follow a dip in US air strikes in Somalia. Africa Command carried out four in the past two months, compared with 28 in the first three months of 2019.
The US carried out 43 strikes against al Shabaab so far this year, against 47 in 2018.
Last year the Pentagon said it would withdraw hundreds of troops focused on African counter-terrorism operations, as the military increasingly focuses on China and Russia.
The Pentagon cut 300 troops from the continent. The head of US forces in Africa is undertaking a broad review on whether a further300 troops need to be cut.
Al Shabaab said its fighters breached the base perimeter, denied by police.
“In the early hours of Monday, an elite unit of soldiers from Harakat Al-Shabaab Al Mujahideen’s Martyrdom Brigade launched a daring raid on the US military base,” the group said in a statement.
“After breaching the perimeters of the heavily fortified base, the mujahideen stormed the military complex, engaging the crusaders in an intense firefight.”
Al Shabaab is fighting to overthrow the UN-backed Somali government and enforce its own strict version of Islamic law in a country riven by civil war since 1991.
In a separate attack on Monday in Mogadishu, a roadside bomb targeted an Italian military convoy. A Reuters journalist saw a damaged armoured vehicle bearing a small Italian flag sticker. The Italians are part of a European Union mission training Somali forces.
The incidents follow other major al Shabaab attacks.
On September 22, insurgents attacked a base in El Salini, southwest of Mogadishu, using a suicide car bomb and gunmen.
A week earlier, al Shabaab said it killed 14 Burundian peacekeepers. The African Union said three Burundians were killed.