Studying in Istanbul on a full government scholarship, Somali student Nur Hassan Bukhari is worried that attacks targeting Turkish interests could derail relations between the two countries.
"It was brutal," Bukhari told Al Jazeera of a bombing on the Turkish mission in Mogadishu on July 27. "Al-Shabaab always wants our country to become lawless. I hope our relations with Turkey will not suffer."
A Turkish police officer was killed along with three attackers when an explosives-laden car rammed into an office building housing the Turkish embassy staff in the Somali capital.
While the killings shocked the Turkish public, analysts are not suprised that al-Shabaab claimed responsibility for the bombing.
|Inside Story - Somalia's peace: Running on empty?
The al-Qaeda-linked group has long opposed the Turkish presence in Somalia. Denouncing Turkey's involvement as a cover for Western invaders, al-Shabaab posted a message on Twitter to justify the attack.
"The Turkish are part of a group of nations bolstering the apostate regime and attempting to suppress the establishment of Islamic Sharia," it read.
Al-Shabaab was forced out of Mogadishu by Somali and African Union forces two years ago. In August 2011, Turkish Prime Minister Recep Tayyip Erdogan traveled to Somalia, making him the first non-African leader to visit Somalia in the past two decades.
Erdogan brought a plane full of ministers and consultants with him, during one of the worst famines to hit the Horn of Africa in 60 years. Since then, Turkey has launched a major diplomatic, economic and humanitarian effort in Somalia.
"Turkey gave more than $1bn in humanitarian aid in 2012," the Global Humanitarian Assistance 2013 report says, making it the fourth-largest donor in the world. In 2011, Somalia was the largest recipient. According to the Turkish Prime Minister's Office of Public Diplomacy, Turkey sent $365m in cash and in-kind aid to the country last year.
|Turkey's growing Somalia interests
There are hundreds of Turkish relief workers in Mogadishu. Among 20 Turkish aid agencies operating in Somalia, the Turkish Red Crescent and Turkish International Cooperation and Development Agency are playing an active role in rebuilding the country.
They have assisted with drilling boreholes across the country, building hospitals, rehabilitating parts of Mogadishu airport and restoring some government buildings, including the National Assembly.
In March 2012, Turkish Airlines became the first international airline in two decades to operate regular flights to Mogadishu's Aden Adde International Airport.
Turkey hopes to gain not only from Somalia's potential oil reserves, but also wants to play an active role in Africa's emerging markets.
The Turkish Ministry of Economy has been implementing the "Strategy for Enhancing Trade and Economic Relations with African Countries" since 2003. Turkey’s exports to the continent grew four-fold between 2003 and 2011, leaping from $2.1bn to $10.3bn. The number of Turkish embassies in Africa increased from 12 in 2009 to 34 in 2013.
The Turkish parliament approved an agreement last November to train Somali security forces. This policy, according to Abdullah Bozkurt, Ankara bureau chief for the newspaper Today's Zaman, was the motive behind the al-Shabaab attack on the Turkish mission.
"The security dimension is a direct challenge to al-Shabaab and al-Qaeda affiliated groups because Turkey, a country that has been fighting with terror groups for years, can make a difference in training Somali forces on how to address to the terror issue," Bozkurt told Al Jazeera. "I believe the aim of the attack is to deter Turkey from engaging further in rebuilding Somalian security forces including intelligence service; a kind of warning to the Turkish government to stay away from Somalia."
|Turkey hosted conference on Somalia in May, 2012
Security forces knew an attack would be possible, diplomats said.
"There was a threat to Turkish institutions, that's why the sandbags were placed to the outer walls of buildings. We warned the Somali police, but unfortunately they didn't take the necessary measures," Turkey's ambassador to Somalia, Cemalettin Kani Torun, told Al Jazeera. "If they [had] prevented the vehicle coming to our front door, this incident wouldn't [have] occured."
"The message to us is to get out of here, but of course we will stay and complete the projects we've launched; that's what the vast majority of Somalia request."
The recent bombing was not al-Shabaab's first attack against Turkish targets. In April, several Somalis were killed and three Turkish officers injured when a humanitarian convoy of the Turkish Red Crescent was hit in a bomb attack in Mogadishu.
Al-Shabaab's largest attack was in October 2011. It wasn't directly targeting Turkey's convoys or buildings, but rather its humanitarian efforts. A suicide truck-bomber killed more than 70 people, many of them students and their parents, waiting for the results of scholarships offered by Turkey outside of the Ministry of Higher Education.
The Somali Students Union in Turkey states that there are around 1,600 Somali students who live and study in Turkey, and 99 percent of these students received scholarships. But it is rare for Somali students to complete their studies in Turkey. Many have other plans, like Nur Bukhari.
"I am planning to return home soon to serve my people and my country with what I had studied so far," Bukhari said. "My country needs educated people who can turn this bad situation into a good one."
Follow Dilge Timocin on Twitter: @dilgetimocin