An Emirati national, who was arrested in Libya's capital in 2015 on suspicion of espionage, has been killed by a member of the intelligence services who was himself shot dead, according to Tripoli's state prosecutor.

Seddiq es-Sour said on Wednesday that the detained man was arrested in November 2015 and was awaiting trial on charges of links to Dubai's police force.

"He claimed to be a businessman with no ties to Dubai police but intelligence agents found photographs of sensitive sites on his phone, including of the Turkish embassy," Sour said.

"A member of Libyan intelligence killed the Emirati citizen before being gunned down by security forces," the prosecutor added, without giving a date for the incident.

Former sergeant

Police in Dubai, an emirate in the United Arab Emirates, have denied links to the unnamed man, but said he had served as a sergeant with the force until five years ago.

At the time of his arrest, Tripoli was controlled by a militia-led coalition which accused Arab states of supporting a rival general based in east Libya.

Libya has been riven by lawlessness and fighting since the 2011 toppling and killing of Muammar Gaddafi, with rival governments and armed forces vying for territory and a share of the country's vast oil riches.