Heavy fighting has been raging inside Somalia's presidential palace after at least five suspected al-Shabab fighters stormed the complex in the capital, Mogadishu.

Al Jazeera's correspondent reported an explosion followed by sounds of gunfire inside the compound on Tuesday evening.

President Hassan Sheikh Mohamud was not in the presidential compound when it was attacked, the interior minister said. 

The prime minister and the speaker of parliament were inside the premises, a senior police official said.

Captain Mohamed Hussein, a senior police official, said that the fighters, who were armed with grenades, split up into groups once inside and tried to take control of different buildings in the compound.

"The operation is still under way," said Hussein.

Al-Shabab claims responsibility

There were no confirmed reports of casualties but an official at the presidential palace spoke of deaths among the fighters.

"The militants have partly entered the presidential palace compound. There is periodic gunfire now," the official told the Reuters news agency.

"I understand most attackers have been killed. No further details."

Al-Shabab confirmed they were involved.

"We have entered the so-called presidential palace. We have now captured some parts of the palace and fighting is still going on," Sheikh Abdiasis Abu Musab, Shabab's military operations spokesman told Reuters.

The attack late Tuesday is the second assault on the presidential palace this year, and it marked the first time fighters have been able to breach the compound and take offensive positions inside.

The presidential palace is protected by government troops and African Union peacekeepers who helped to drive the al-Shabab fighters out of their bases in Mogadishu in 2011.

However it was not known if the peacekeepers were involved in Tuesday's fighting.

Source: Al Jazeera and agencies