Police have said that Somali gunmen tried to kidnap a Swedish opposition politician in an ambush in Mogadishu in which two men were killed.

Witnesses said Ann-Margarethe Livh, an opposition Left Party city councillor in Stockholm, was returning to her hotel after giving a speech at the University of Somalia when the gunmen struck near the Turkish embassy.

She received a gunshot wound, but her injuries are not life threatening.

Police said an officer guarding her and a man said to be her translator were killed.

A Somali woman from Sweden was also wounded, they said.

The Swedish Foreign Ministry said Sweden's ambassador to Somalia has spoken to Ms Livh.

The ministry said preparations were under way to move her to Kenya after treatment in Mogadishu.

There was no immediate claim of responsibility.

However, al-Qaeda-linked al-Shabaab militants have kept up guerrilla-style attacks and kidnappings in the city despite being largely pushed out by Somali and African forces two years ago.

Last week, a medical charity that was a lifeline for hundreds of thousands of Somalis announced it was pulling out of the country, saying the threat of deadly violence had become intolerable.

Police investigating kidnap attempt

Ms Livh is the most prominent Left Party politician in Stockholm.

A party spokeswoman told Sweden's TT news agency the group was in Mogadishu "in connection with an international project within the work of the Left Party".

Bile Ibrahim, of the criminal investigation department, said police were investigating an attempted kidnap.

"Our initial investigation shows that the attack was motivated by a kidnap of the white woman," Mr Ibrahim told Reuters.

"The men were three to four, armed with AK47s and they blocked the road in front of the car which the white woman was on board.

"They did not want to kill her, but to kidnap her."

He said three university lecturers were being questioned.

Somalia has a new elected government that has been in charge for about a year.

It is attempting to rebuild itself after two decades of civil war and lawlessness, triggered by the overthrow of president Siad Barre in 1991.