Somali commandos accompanied by US forces in two helicopters raided two locations, the official said.

They included a detention center run by al-Shabab in Kunya-Barrow village in Lower Shabelle region, and an unknown number of detainees were freed.

Troops engaged a small number of extremist fighters, said the official, who spoke on condition of anonymity because he was not authorized to speak to the press.

There was no immediate comment from the US Africa Command.

The al-Qaeda-linked al-Shabaab said via its Andalus radio arm that its fighters foiled an attempted raid by US and African forces.

Earlier this month, the US military said it carried out an airstrike against al-Shabaab in Somalia and was assessing the results. 

The airstrike followed another last month that the US said killed eight extremists at a rebel command and logistics camp in the country's south. 

Somalia President Mohamed Abdullahi Mohamed said a training camp near Sakow in the Middle Juba region had been destroyed.