Libya embassy russia
The Russian embassy in Tripoli was attacked by an armed mob (Reuters)

The Russian embassy in Tripoli was attacked by an armed mob in retaliation for the death of a Libyan official who was allegedly murdered by a Russian woman.

The Kremlin has evacuated all of its diplomats and their families from Libya and issued a warning to its citizens against visiting the country, after gunmen stormed the embassy sparking a shootout with security forces.

About a 10 people arrived at the compound in the capital aboard several cars and broke in, climbing the external wall and breaking down a metal gate, the Libyan Internal Affairs Ministry said.

The gunmen started shooting in the air, set fire to an embassy car and tore down a Russian flag. Security guards intervened killing one of the attackers and wounding four.

Russia's Foreign Ministry said none of its staff was injured.

However Libya's Foreign Minister Mohamed Abdelaziz told the Russian ambassador that Libyan authorities were unable to protect their diplomatic personnel, prompting the evacuation, Russian Foreign Ministry spokesman Alexander Lukashevich said.

All the embassy workers and their families have safely crossed the border into Tunisia Lukashevich said.

A handful of senior diplomats are to continue their work in Tunisia, while the rest of are to be flown back to Moscow.

Russia's Foreign Ministry said the attack came in response to the murder of a Libyan air force officer, who was allegedly machine-gunned by Russian woman named only as Katerine.

Police believe Air Force engineering official Mohamed Alsusi was slayed in his Tripoli house by the woman who then also shot and stabbed the victim's mother.

The 24-year-old woman also used the man's blood to write "Death to Rats" in English on a wall of the house, said Hashim Bishar, head of Tripoli's Supreme Security Committee. Her motive for the murder is not clear.

The woman was held by police and interrogated for six hours, Bishar said."She entered Libya as a journalist, she is now in the custody of the attorney general's office," he told The Guardian.

Two years after the overthrow of Muammar Gaddafi the Libyan government is struggling to maintain security, as competing militia groups control entire areas of the country.