By Thomas Grove
MOSCOW (Reuters) - Russia evacuated embassy staff and their families from Libya on Thursday after gunmen tried to storm its diplomatic mission in Tripoli.
The attackers, who dispersed when embassy security guards opened fire, had planned to avenge the murder of a Libyan military officer by a Russian woman living in Tripoli, the foreign ministry said in a statement.
"Relatives and friends of the murdered Libyan decided to avenge his death with an attack on the Russian diplomatic mission," the statement said.
The decision to evacuate staff was taken after Libyan Foreign Minister Mohammed Abdelaziz visited the embassy.
The ministry said he had told the Russian ambassador that Libya was "not in a state to guarantee the security of the Russian embassy and recommended his employees leave the diplomatic mission".
The statement said that staff and their families had taken refuge in safe rooms during the attack. They were evacuated to Tunisia on Thursday and expected to return to Russia on Friday.
The attack demonstrated the volatility in oil-producing Libya two years after the overthrow of Muammar Gaddafi, and the problems faced by his former ally Russia as it tries to put billions of dollars' worth of energy and arms deals back on track.
The Foreign Ministry and the Kremlin were keen to play down political angles of the attack, citing the murder as the cause.
The Russian woman, who also wounded the officer's mother, had been arrested, the statement said.
Diplomatic sources in Libya said security guards fired shots to disperse a group of about 60 people who tried to storm the embassy on Wednesday. Russian agencies said the gunmen arrived in two vehicles before opening fire.
The statement sought to underline cooperation by the two countries to reestablish Russia's full diplomatic presence in Libya and reduce any long-term impact.
Clan and tribal rivalries, as well as Islamist groups, have flourished in the absence of strong central government in Libya. Security services have struggled to maintain order.
Militant groups have staged a number of attacks on Western diplomats. Militants linked to al Qaeda affiliates attacked the U.S. consulate in Benghazi and killed Ambassador Christopher Stevens and three other Americans on September 11, 2012.
"When Gaddafi was in charge, ties (between Libya and Russia) were good. He was buying our weapons and there was talk of a railroad being built," said Moscow-based analyst Georgy Mirsky.
Asked about the attack, he said: "This kind of thing happens all the time, there is no reason to exaggerate it."
Russia says it lost billions of dollars in arms deals after the fall of Gaddafi, who was captured and killed in October 2011 after months of civil war. The violence prompted Russian companies, which had pumped hundreds of millions of dollars into Libya's oil and natural gas sectors, to put their investments on hold.
The attack on the embassy occurred as a Russian delegation was planning to visit Libya to try to put commercial relations back on track, the head of a business council said.
"Unfortunately these kinds of things happen, not regularly, but they happen, but that doesn't mean you have to stop business. It shouldn't be a reason not to restart business and a relationship," Aram Shchegunts said.
In a sign that the situation may be improving, Tatneft, a mid-sized Russian oil producer which invested $200 million in Libyan oil exploration, reopened an office in Tripoli earlier this year. But it also said it was yet to restart production at Libyan oil fields.
(Editing by Timothy Heritage and Angus MacSwan)