At least seven people were wounded on Saturday as police shot a suicide car bomber at a checkpoint outside the port in Somalia's capital Mogadishu, police and witnesses said.
"A suicide bomber tried to strike the police post in front of the port but the security forces shot him and the vehicle exploded," said police officer Abdukadir Ahmed.
"Two police officers and five civilians were wounded," he said.
There was no immediate claim of responsibility.
Witnesses said officers opened fire on the vehicle after it failed to stop at the police checkpoint.
Somalia has suffered near-continuous conflict for almost 30 years, while the internationally-backed government in Mogadishu has been fighting Shabaab Islamic insurgents since 2008.
Bombings and other terrorist attacks are common in Mogadishu, although few have been recorded in recent months.