At least 12 people were killed Friday as twin blasts and gunfire rocked a hotel and neighbouring park in central Mogadishu, police said, in an attack claimed by the Al-Qaeda-linked Shebab militants.

Two loud explosions went off near the popular SYL hotel and neighbouring Peace Garden followed by more than an hour of automatic gunfire from 7:45 pm (1645 GMT), an AFP correspondent said.

The hotel and park are located close to the top-security Villa Somalia complex that houses the presidential palace and the prime minister's office.

"One of the explosions took place near the Peace Garden and the other near the SYL hotel," police official Ibrahim Mohamed said.

"I saw 12 dead civilians, but the number could be higher."

Medical sources told local media that at least 25 people had been injured.

The attack is the second in a year to target the SYL hotel, following a suicide bombing there in January 2015 that left five people dead.

The neighbouring Peace Garden is popular with Mogadishu residents, especially on Fridays, thanks to its children's playground and cafe terraces.

The Shebab movement claimed responsibility for the attack in a brief statement on its Instagram account.

"Members of the mujahedeen have carried out an attack on the SYL hotel near the presidential palace," it said.

"The attack began with a suicide bombing followed by gunfire."

An AFP journalist reported that the shooting had stopped by just after 9:00 pm (1800 GMT).

Security sources, speaking on condition of anonymity, told AFP that it was not believed that any attackers had been able to enter the hotel.

At least two of the assailants were killed outside the hotel, where armed guards had opened fire just as the attack was launched.


String of spectacular attacks

Routed from Mogadishu in mid-2011, the Shebab are on a mission to disprove suggestions they are close to defeat and have claimed several spectacular attacks in recent months.

On February 2 the Islamists said they had carried out a bombing that ripped a hole in a passenger jet shortly after take-off from Mogadishu airport, killing the suspected bomber.

Several recent attacks have seen explosive-laden cars driven at speed into the walls of hotels, with gunmen then entering to mow down staff and clients.

On November 1, at least 12 people were killed in a dawn attack at Mogadishu's Sahafi hotel, which is popular with politicians and business executives.

A similar attack was launched against the Central Hotel in February 2015, killing more than 20 people.

The Shebab is fighting to overthrow the internationally-backed government in Mogadishu, which is protected by 22,000 African Union troops.

Having lost most of their strongholds, the group have increasingly taken to suicide bombings and guerrilla tactics instead of conventional combat.

They continue to control huge rural areas where they launch guerrilla operations and suicide attacks -- often approaching the capital -- against government targets or the AMISOM African Union force.