A Libyan court on Tuesday sentenced Muammar Gaddafi's most prominent son, Saif al-Islam, and eight others to death for war crimes, including killings of protesters during the 2011 revolution that ended his father's rule.

The former Gaddafi regime officials sentenced to die by firing squad included former intelligence chief Abdullah al-Senussi and ex-prime minister Baghdadi al-Mahmoudi, Sadiq al-Sur, chief investigator at the Tripoli state prosecutor's office, told a televised news conference in Tripoli.

The trial outcome drew swift criticism abroad, with Human Rights Watch and a prominent international lawyer saying it was riddled with legal flaws and carried out amid widespread lawlessness undermining the credibility of the judiciary.

Eight ex-officials received life sentences and seven jail terms of 12 years each, Sadiq said. Four of the 37 defendants were acquitted, others got shorter jail terms.

Muammar Gaddafi himself was killed by rebels who captured him after months on the run.

Sadiq did not spell out the charges on which the verdict was based, referring to the expected written ruling. Defendants had been accused of a range of offences including the use of deadly force against unarmed demonstrators, as well as corruption.

The verdict on Saif al-Islam was passed in absentia in Tripoli since he has been held since 2011 by a former rebel group in the mountainous Zintan region beyond central government control. Factional disorder and conflict now plagues Libya.

Saif appeared by video link only at the start of the trial. The Zintanis have refused to hand him over, saying they do not trust authorities in Tripoli to make sure he does not escape, but agreed to let him be tried there.

The sentences can be appealed and must be confirmed by Libya's Supreme Court, but legal experts and rights advocates said the proceeding was tainted and politicized from the start.

 JUSTICE UNDER FIRE IN LIBYA

New York-based Human Rights Watch (HRW) said defense lawyers lacked full and timely access to case files and several had been unable to meet with clients in private while two quit after receiving threats.

"There are serious questions about whether judges and prosecutors can be truly independent where utter lawlessness prevails and certain groups are unashamedly shielded from justice," Joe Stork, HRW's deputy Middle East and North Africa director, said in an emailed statement.

"This trial was held in the midst of an armed conflict and a country divided by war where impunity has become the norm ...The victims of the serious crimes committed during the 2011 uprising deserve justice, but that can only be delivered through fair and transparent proceedings," Stork said.The International Criminal Court (ICC) had wanted to try Saif al-Islam and Senussi in The Hague but in 2013 granted Libya the right to do so at home despite doubts about the impartiality and competence of its judicial system.

John Jones, a British lawyer hired to represent Saif al-Islam before the ICC, said a "show trial" led to the death sentences. "The whole thing is illegitimate from start to finish... It's judicially sanctioned execution," Jones said.

The ICC does not allow the death penalty.

The trial began in April 2014 before fighting between rival factions in Tripoli ripped Libya apart in a power struggle which has produced two governments competing for authority.

Tripoli is now controlled by a self-declared government set up after an armed faction called Libya Dawn seized the capital in August, expelling the internationally recognized government, which then decamped to far eastern Libya.

Fighting involving remnants of the armed forces, ex-rebel groups, regional tribes and Islamist militants has sewn chaos in the North African oil-producing country, thwarting any post-Gaddafi transition towards democracy.