Gunmen have killed at least 14 people in an attack on a hotel and office complex in the Kenyan capital, Nairobi.

The attack has been claimed by Somali Islamist militant group al Shabaab.

Eight hours after the assault began at Nairobi's upscale 14 Riverside Drive complex, a burst of gunfire was heard in the area, suggesting the situation was not yet under control.

Scores of people were still hiding inside the complex, a security source said.

A mortuary worker said that 14 people were killed in the attack.

Earlier, Interior Minister Fred Matiang'i said that all buildings had been secured and scores of people evacuated from the scene.

He did not comment on the whereabouts of the attackers and said security forces were still "mopping up" in the area.

Nairobi is a major expatriate hub, and the compound targeted contained offices of various international companies, in an echo of a deadly 2013 assault on a Nairobi shopping centre in the same neighbourhood.

"The main door of the hotel was blown open," said Serge Medic, the Swiss owner of a security company who ran to the scene to help when he heard of the attack from his taxi driver.

Mr Medic, who was armed, entered the building with a policeman and two soldiers, he said, but they came under fire and retreated. An unexploded grenade lay in the lobby, he said.

"One man said he saw two armed men with scarves on their head and bandoliers of bullets," Mr Medic added, as gunfire echoed in the background.

Kenya has often been targeted by al Shabaab, who killed 67 people at the Westgate shopping centre in 2013 and nearly 150 students at Garissa university in 2015.

Al Shabaab says its attacks are revenge for Kenyan troops stationed inside Somalia,which has been riven by civil war since 1991.

Firefighters work on cars damaged in the attack

Kenyan police chief Joseph Boinnet said the attack began at around 3pm local time with an explosion targeting cars outside a bank followed by a detonation from a suicide bomber in the hotel lobby.

As he spoke, a Reuters reporter on the scene reported heavy gunfire, then an explosion shortly afterwards.

CCTV footage showed three attackers dressed in black running across the parking lot at 3.30pm shortly followed by a fourth.

At least two of the men were wearing green scarves in the close-up footage. One appeared to be wearing a green belt with grenades in it.

Al Shabaab, which wants to overthrow the weak, United Nations-backed Somali government and impose strict Islamic law, quickly said it was responsible, according to Abdiasis Abu Musab, the group's military operations spokesman.

According to its website, 14 Riverside is home to local offices of international companies including Colgate Palmolive, Reckitt Benckiser, Pernod Ricard, Dow Chemical and SAP.

Kenya is a base for hundreds of diplomats, aid workers,businessmen and others operating around east Africa.

The Australian embassy is across the road from the compound.

Kenyan television featured appeals for blood from local hospitals and showed police cordoning off the route to ensure vehicles could move quickly. Red Cross ambulances ferried victims away.

Kenyan troops, concentrated in south Somalia, originally went into Somalia to try to create a buffer zone along the border. They are now part of an African Union peacekeeping force.

The attack took place as a Kenyan court prepares to sentence four men accused of aiding the Westgate mall attack.