A car bomb has exploded in the Somali capital outside the gates of a hotel where Turkish delegates were preparing for the visit of their president.
Three people were killed in the attack, including two security officers and a hotel employee, police told the BBC.
None of the Turkish contingent at the SYL Hotel, located in the heavily secured area near the presidential palace, was hurt in the blast.
Al-Qaeda-linked militants often carry out attacks in Mogadishu.
It will be President Recep Tayyip Erdogan's second visit to Somalia - he first visited as Turkey's prime minister during the famine of 2011.
Since then Turkey has taken a lead in helping Somalia's government rebuild roads, schools and hospitals.
Turkish companies are also refurbishing Mogadishu's port and airport.
Correspondents say there is extra-tight security in Mogadishu in anticipation of Mr Erdogan's visit, especially around the presidential compound.
Eyewitness Abdukadir Munin told the AFP news agency he saw a vehicle "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. I don't know if they were dead," he said.
Turkish officials say President Erdogan's trip will go ahead as planned.
Since the Islamist al-Shabab group lost control of the capital in 2011, security has improved in the city - although its fighters still stage suicide attacks.
African Union forces and the Somali army have also managed to gain control of other key towns, but the group still holds sway over many rural southern areas.