US special forces have aborted a mission to capture an al Shabaab leader in Somalia after coming under heavy attack.
Their target was Mukhtar Abu Zubeyr, also known as Ahmed Godane, who claimed responsibility for last month's Nairobi shopping mall massacre that killed at least 67 people, according to a Somali intelligence official.
A Navy Seal team staged a pre-dawn raid on a house in the southern town of Barawa after swimming ashore before the al Qaeda-linked militants rose for morning prayers.
Reinforcements arrived at the house and Seal Team Six, the same unit that killed Osama bin Laden in Pakistan in 2011, encountered fiercer resistance than expected, a senior US military source told The Associated Press.
After a 15 to 20-minute firefight, the unit leader decided to abort the mission and they swam away, the source said.
Al Shabaab later claimed there was "no senior official" in the house at the time of the raid.
The group posted pictures on the internet of what it said was US military gear left behind, including bullets, a GPS device and a stun grenade.
US Secretary of State John Kerry, in Bali for an economic summit, spoke about the failed US operation, and said terrorists "can run but they can't hide".
A Pentagon spokesman confirmed that US military personnel had been involved in a counter-terrorism operation against a known al Shabaab terrorist in Somalia, but did not provide details.
He said there were no US casualties in the raid.
Within hours of the attack, the US Army's Delta Force carried out a raid in Libya, and captured an al Qaeda leader wanted for the 1998 bombings of the US Embassies in Kenya and Tanzania that killed more than 220 people.
US Defense Secretary Chuck Hagel said the Libya and Somalia operations showed America would "spare no effort to hold terrorists accountable".
The aborted Somalia operation came 20 years after the famous "Black Hawk Down" battle in Mogadishu, in which a mission to capture Somali warlords went wrong when militia forces shot down two US helicopters and killed 18 American soldiers.
Residents in Barawa, a seaside town some 150 miles south of Mogadishu, said they woke up to the sound of heavy gunfire.
The SEAL team killed a guard and battled their way inside a two-storey beachside house, where al Shabaab fighters reportedly lived, before being driven back.
A US official said the mission was aimed at capturing a "high-value target" while trying to avoid civilian casualties.
A Barawa resident called Mohamed Bile said militants closed down the town in the hours after the raid, and were carrying out house-to-house searches to find evidence that a spy had tipped off the US.
"We woke up to find al Shabaab fighters had sealed off the area and their hospital is also inaccessible," he told The Associated Press by phone. "The town is in a tense mood."
Speaking after the US raid, Somalia's Prime Minister Abdi Farah Shirdon said his government was "collaborating with the world and neighbouring countries" in its battle against al Shabaab.
Last month, addressing the UN Human Rights Council in Geneva, he denounced the group's "cowardly attack" in Kenya, but said a military solution to their insurgency was not enough.
He praised the 17,000-strong African peacekeeping force in Somalia for improving security and fighting al Shabaab, who he said were now weakened. But he said Somalia needed economic stability to cut youth unemployment.
"This provided al Shabaab a building ground to recruit and spread their destructive ideology. It is therefore essential to create educational and economic opportunities for youth," he warned.