LIBYAN prosecutors opened the trial of deposed leader Muammar Gaddafi's sons and more than two dozen of his ex-officials yesterday in a major test for the North African state's transition to a democracy.

Gaddafi's sons Saadi Gaddafi and Saif al Islam did not appear in the courtroom at Tripoli's Al Hadba prison, but the deposed ruler's ex-spy chief Abdullah al Senussi was among the former senior officials sitting in blue jumpsuits behind a fenced-off section.

The men face charges ranging from corruption to war crimes related to the deaths during the 2011 uprising, which expanded into a civil war that ousted Gaddafi. The former Libyan leader was later killed after being captured by rebels.

Addressing the four judges, many of the defendants complained they had not been given access to lawyers or only saw them at court appearances.

"I want to be treated like other prisoners. I want visiting rights. I don't have a lawyer," Senussi said.

Prosecutors said Senussi had been allowed to see relatives, but denied lawyers had been prevented from visiting their clients at the prison.

Post-Gaddafi Libya has so far been defined by a weak interim government and growing unrest as former revolutionary fighters refuse to give up their weapons, and armed protesters blockade the country's crucial oil exports.

The trial began a day after interim prime minister Abdullah al Thinni announced his resignation.