US special forces have failed in an attempt to kill a senior leader of al-Shabaab, the Somali Islamist group, in response to the deadly attack on a Nairobi shopping mall two weeks ago.

A US Navy Seal team attacked the leader, named by a Somali intelligence official as Mukhtar Abu Zubeyr, at his seaside villa in the Somali town of Baraawe, south of the capital Mogadishu, in a pre-dawn, sea-launched attack yesterday.

US forces said last night that they were forced to withdraw before they could confirm the target was dead, after fighting broke out, and it has now emerged that Zubeyr survived.

Download the new Independent Premium app Sharing the full story, not just the headlines

Such operations by American forces are rare because they carry a high risk, and indicate the target was considered a high priority, The New York Times reported last night. “The Baraawe raid was planned a week and a half ago,” an American security official told the newspaper. “It was prompted by the Westgate attack,” he added, referring to the Nairobi mall that was overrun by militants, leaving more than 60 dead.

Baraawe is known as a gathering place for al-Shabaab's foreign fighters. Witnesses described a firefight lasting over an hour with helicopters for air support.

A senior Somali government official who spoke on condition of anonymity confirmed the raid, saying: “The attack was carried out by the American forces and the Somali government was pre-informed about the attack.”

US officials said that its troops made the decision to fall back after civilian casualties became an increasing concern.

Seven people were confirmed killed – but there were no US deaths, and a spokesman for al-Shabaab said just one of its fighters had died in gunfire.

The group boasted that it had successfully beaten back the assault, and released images of US equipment which had been left behind in the retreat.

The attack came just hours before a similar raid in Libya against the al-Qa’ida leader Anas al-Libi, which had a very different result. Meeting with no armed resistance after they surprised al-Libi at his home, a convoy of three US military vehicles was able to capture the computer specialist alive.

The US Secretary of State John Kerry said that the two operations against militants in north Africa sends the message that terrorists “can run but they can't hide”.

Meanwhile, a Kenyan military spokesman said yesterday it had identified four of the Westgate shopping mall attackers from surveillance footage.