At least 20 people have been killed and several others wounded in a massive truck bomb attack outside a hotel in Somalia's capital, Mogadishu, police said, with officials fearing many casualties from the unusually large explosion.

The blast on Saturday, in the central K5 Junction which is lined with government offices, hotels and restaurants, destroyed several buildings and set dozens of vehicles on fire.

"We know that at least 20 civilians are dead while dozens of others are wounded," Abdullahi Nur, a police officer who was in the area, told Reuters news agency.

"The death toll will surely rise. We are still busy transporting casualties," he said, adding that there were bodies under the rubble.

The explosion was followed by gunfire between security forces and armed men around and inside the popular Safari Hotel.

"The fighters first detonated a bomb outside the hotel's gate, and then about four gunmen on foot gained entry into the hotel and started shooting at the patrons and also the security of the hotel," Al Jazeera's Mohammed Adow, reporting from Doha, said.

"The hotel's security staff, together with the police, are engaging a gunfight inside and outside the hotel," he added.

It was not immediately clear whether Safari Hotel, which is not frequented by government workers, was itself the intended target of the attack. The Somali foreign ministry is also located nearby.

'Biggest blast I have ever witnessed'

Security official Mohamed Adan told AFP news agency the "huge blast" was caused "by a truck loaded with explosives".

Witnesses said the blast, which threw a thick cloud of smoke into the sky that could be seen across the city, badly damaged a nearby hotel and left scenes of devastation on the busy road.

"This was very horrible," witness Ismail Yusuf told AFP news agency.

"The bomb went off alongside the busy road and left many people dead. I saw several dead bodies strewn about but could not count them," he added.

Muhidin Ali, a Mogadishu resident who was close by at the time said it was, "the biggest blast I have ever witnessed, it destroyed the whole area".

Abdi Dhaqane, who was also close to the site of the explosion, agreed.

"I have never witnessed a scene like this ever before," he said. "All the buildings around here have collapsed. There were close to 200 people in those buildings. I hope everyone is OK."

Later on Saturday, a second blast took place in the city's Madina district.

"It was a car bomb. Two civilians were killed, " Siyad Farah, a police major, told Reuters, adding that a suspect had been caught on suspicion of planting explosives.

READ MORE: Al-Shabab launches deadly attack on Somalia army base

There was no immediate claim of responsibility.

Al-Shabab, an armed group fighting to overthrow the internationally recognised government, has carried out frequent gun, grenade and bomb attacks in Mogadishu and other parts of Somalia.

Al Jazeera's Adow said the car bomb blast had "all the hallmarks" of an al-Shabab attack.

"This is what they've been doing since 2011, when they lost control of Mogadishu. The government has been unable to figure out how to stop these kinds of attacks," he said.