A son of the late Libyan dictator Muammar Gaddafi has been sentenced to death by a court in Tripoli over war crimes committed during the 2011 uprising.

Saif al-Islam Gaddafi was handed the capital punishment along with eight other defendants, including former spy chief Abdullah al-Senussi.

The 43-year-old was not in court as the sentence was read as he is being detained by a rival militia group in the western town of Zintan, which refuses to hand him over to authorities in Tripoli.

A close aide to his father, with a PhD from the London School of Economics, he was captured towards the end of 2011.

Libya has been embroiled in fighting between rival militias since Colonel Gaddafi was overthrown by Arab Spring protesters that year, with the backing of a Nato-led campaign sparked by the dictatorship's violent crackdown on demonstrations.

The country is currently locked in a three-way power-struggle pitting forces loyal to the internationally recognised government headquartered in Tobruk against Libya Dawn, an umbrella group including radical and moderate Islamists that controls Tripoli, and other jihadi factions including Islamic State (Isis).

Saif's younger brother Saadi, who had a brief stint as a professional footballer where he played in Italy's Serie A, is being tried separately in the capital for murder.