Somalia's Al-Qaeda-linked Shebab said Saturday British and Turkish special forces staged a nighttime sea and air attack on one of its bases, but Britain denied any involvement.
Leaders of the Islamist insurgents in the southern Somali port of Barawe said commandos rappelled from a helicopter and tried to storm a house belonging to a senior Shebab commander, but the assault failed.
The assault comes two weeks after Shebab gunmen attacked Kenya's Westgate shopping mall, massacring 67 people in a four-day siege. Six Britons were among the dead.
"The enemy of Allah tried to surprise the mujahedeen commanders with a night attack using a military helicopter, but they were taught a lesson and they have failed," Mohamed Abu Suleiman, the Shebab commander in the small seaside town, told AFP.
"Our mujahedeen fighters inside the house fought back and the cowards ran away," Suleiman added.
Shebab spokesman Abdulaziz Abu Musab later blamed the raid on "Britons and Turks".
He said commandos had also stormed the beach by boat.
"Where the foreigners had been, afterwards we saw lots of blood, so maybe we wounded some," he added.
Britain denied the claim it was involved.
"There is no British involvement," a spokeswoman for Britain's Ministry of Defence told AFP when asked to comment on the raid.
She would not give any further details.
Witnesses reported heavy gunfire as the helicopter hovered overhead.
"I woke to the sound of the helicopter above the neighbourhood, then a few minutes later, there was fighting, gunfire broke out for about 10-15 minutes," said a local resident who asked not to be named.
"We don't know what exactly happened, but it was an organised attack targeting the house where some Al-Shebab commanders were."
Barawe lies some 180 kilometres (110 miles) south of the capital Mogadishu, and is one of the few ports left in Shebab hands, although they still control large parts of rural southern Somalia.
Photographs released by the Shebab earlier this year showed dozens of their fighters armed with heavy machine guns in Barawe.
Residents of Barawe said Shebab gunmen were heavily deployed on the streets of the port on Saturday.
"People are being stopped from getting close to the scene of the attack, heavily armed Shebab soldiers have cordoned off the area," said Mohamed Nune, a resident.
Multiple nations operate special forces in the wider Horn of Africa region, and have carried out similar missions in the past.
In January, elite French forces staged an overnight operation involving some 50 troops and at least five helicopters in southern Somalia in a failed bid to rescue a captured intelligence officer held by Shebab forces.
Last year, US Navy SEALs flying at least six military helicopters swooped into northern Somalia to rescue two aid workers held by pirates.
US drones are reported to regularly fly over Somalia, carrying out occasional missile strikes.
Since their attack in Kenya last month, the Shebab have threatened "rivers of blood" will flow if Kenya does not pull its troops out of Somalia.
Shebab chief Ahmed Abdi Godane said the Westgate mall carnage was retaliation for Kenya's military intervention in Somalia.
Meanwhile security camera footage of the Shebab gunmen in the Nairobi mall attack has been released, showing four young men wandering apparently nonchalantly around the supermarket and a storeroom, in a break from the killing which included the execution of children.