Somali security forces briefly detained two Turkish aid workers on Tuesday after they delivered food to famine victims in an area near the capital controlled by rebels, officials said on Tuesday.
The government's coordinator for humanitarian affairs said the charity workers, including an emergency aid official working with IHH, failed to obtain clearance to meet the Islamist militants fighting to topple the government.
The Turkish aid workers were arrested because they did not coordinate with our national security. They met with al Shabaab without clearance or approval from government security, humanitarian coordinator Mohamud Dahir Farah told Reuters.
They have now been released, he said, adding that a local charity worker remained in detention. Two somali drivers were also arrested.
A Somali intelligence source who declined to be named said the release followed talks between President Sheikh Sharif Ahmed, Turkey's ambassador to Somalia and the Horn of Africa country's chief of intelligence.
(Such arrests are) normal, because of the security situation there. They apologised for the mistake, said an IHH official in Turkey who declined to be named.
The group was arrested late on Monday after delivering food and other emergency supplies to an area 50 km (30 miles) outside the Mogadishu -- known as KM 50 -- where thousands of hungry Somalis are living in squalid refugee camps.
KM 50 is controlled by the al Qaeda-linked militants.
There, IHH's Murat Kacakadam announced the group planned to ship supplies into the rebel-controlled port of Kismayu in southern Somalia, the first known attempt by an aid agency to use the port which is a major source of revenue for the militants.
Turkish Prime Minister Tayyip Erdogan visited Somalia last month as part of his country's push to strengthen its ties with Africa.