UPDATE 2-Al Shabaab claim attack on Turkish mission in Somalia, three dead
* Latest in a series of blasts in June, July
* Death toll rises to 3
* Attackers tried to enter compound housing Turkish staff (Adds Turkish comment, background on ties)
By Feisal Omar and Abdi Sheikh
MOGADISHU, July 27 (Reuters) - A car loaded with explosives rammed into an office housing Turkish embassy staff in the Somali capital, killing three people, witnesses and officials said on Saturday, the latest in a series of blasts claimed by Islamist al Shabaab rebels.
Al Shabaab was pushed out of bases in Mogadishu by Somali and African forces about two years ago, raising hopes of a return to relative security in a city hit by years of war.
But the militants have kept up guerrilla-style attacks and continue to control large rural areas, challenging the authority of a government less than a year old.
The group has carried out several brazen attacks in the last two months, including one on an African peacekeeping convoy that killed 8 and another on the main U.N. compound in Mogadishu that killed 22 people.
"A suicide car bomb targeted a building housing Turkish embassy workers near K4 (Kilometre Four)," police officer Ahmed Mohamud told Reuters from the scene of the blast.
Three people were killed and nine others were wounded, he said.
"The car was taking advantage of a Turkish car that was going into the building, thus the car bomb exploded and destroyed the gate," he said.
A Turkish government official told Reuters that one Turkish security officer was killed when the mission's guards clashed with the attackers as they attempted to enter the complex.
Three Turkish officers were being treated for their wounds, Turkey's Foreign Ministry said in a statement and condemned the bombing.
Al Shabaab, who said earlier this month they would increase attacks during the Ramadan fasting period, claimed responsibility for the bombing on their Twitter feed.
"Mujahideen forces in Mogadishu have just carried out an operation targeting a group of Turkish diplomats in Hodan district," al Shabaab said.
"All the Mujahideen who carried out the operation have returned safely back to their bases inside Mogadishu, preparing for the next operation."
Somalia is attempting to rebuild itself after two decades of civil war and lawlessness, triggered by the overthrow of president Siad Barre in 1991.
The fragile government is being backed by international aid aimed at preventing it from becoming a haven for al Qaeda-style militants in east Africa.
Turkey has led efforts to help Somalia, pouring more than $400 million of aid into the country since 2011, most of it from private companies.
Turkish Prime Minister Tayyip Erdogan became the first non-African leader to visit Somalia in nearly 20 years when he travelled there in 2011.
Turkey has also sought a greater diplomatic role in the region, including brokering dialogue this year between Somalia and Somaliland. (Additional reporting by Humeyra Pamuk in Ankara and Ayla Jean Yackley in Istanbul; Editing by George Obulutsa and Raissa Kasolowsky)