A suicide car bomb has exploded at the gate of a Mogadishu hotel where Turkish delegates were meeting, a day ahead of a visit by their President Recep Tayyip Erdogan to the Somali capital, police have said. 

At least two police officers were killed in Thursday's attack on the SYL hotel, which has been claimed by Somalia's armed group al-Shabab.

"The Turkish delegates are safe inside the hotel," the Reuters news agency reported, citing police captain Farah Nur. "The hotel was busy."

A witness told the Reuters that they had seen two police officers lying dead in front of the destroyed hotel gate, and what appeared to be the mangled body of the suicide bomber.

"I saw [a car] speeding along the main road and the driver turned into the Hotel SYL gate. There was a huge explosion, smoke and shrapnel. Several people were down on the ground," said Abdukadir Munin.

The area around the hotel was quickly sealed off and police fired shots to keep away onlookers, witnesses said.

Quoting police sources, the AFP news agency reported a higher death toll, saying five people had been killed. 

It said three security guards were among the dead. 

Probe under way 

Sources at the hotel, situated close to the heavily-fortified presidential palace, said there were around 70 members of a Turkish delegation in the hotel at the time.

Erdogan will go ahead with his trip, a source at his office in the capital Ankara told Reuters. 

Turkey's Prime Minister Ahmet Davutoglu said an investigation was under way to see if the delegation was deliberately targeted. 

Al-Shabaab, which has carried out attacks across east Africa, including a 2013 raid on a shopping centre in the Kenyan capital Nairobi that killed 67, claimed responsibility for the assault but did not mention the Turkish delegation or Erdogan. 

"We attacked [the] hotel and killed several of the Somali police officers who were meeting there," al Shabab's military operation spokesman, Sheikh Abdiasis Abu Musab, told Reuters.  

Erdogan became the first non-African leader to visit war-torn Somalia in nearly 20 years when he travelled there in 2011, as prime minister. 

Turkey is a key ally of the Somali government. It was a major contributor to the humanitarian aid effort at the height of the 2011 famine and the Turkish government continues to build hospitals and dispatch aid across Somalia.