The three, who had travelled to a camp 50 kilometres (30 miles) southwest of the capital Mogadishu, were freed late Tuesday hours after their arrest.
"The three Turkish aid workers have been released. They argued that they got a permission letter from the interior ministry but there was a misunderstanding because the government did not know that they were travelling to the Shebab controlled areas," said Mohamed Ibrahim, a government security officer.
"We cannot entrust people under our responsibility to Shebab otherwise they could be kidnapped for ransom," he said.
Sources said President Sharif Sheikh Ahmed intervened to have the foreigners freed.
"The president met the three aid workers before they were officially freed late yesterday and he told them that the government cannot accept that people breach security because they can be harmed," security official Siyad Abdulahi said.
Turkish Prime Minister Recep Tayyip Erdogan pledged to help famine-hit Somalia when he visited Mogadishu last month.
Somalia is the country worst affected by a severe drought in east Africa that has left some 13 million people in danger of starvation.
The United Nations last week declared that famine had spread to a sixth region in southern Somalia and warned that it was likely to extend further in the coming four months. (M014/K004)
Editor: Kunto Wibisono
Copyright © ANTARA 2011