The International Criminal Court ruled Friday that Libya can try slain dictator Moamer Kadhafi's former spy chief, the first time it has deferred a case to a national judiciary.
The move can be appealed but could mark the end of a lengthy legal tug-of-war between the embattled ICC and authorities in Libya, which many consider lawless since Kadhafi's bloody overthrow in 2011.
Because Abdallah al-Senussi, 63, is being tried in Libya, ICC judges "concluded that the case is inadmissible before the court, in accordance with the principle of complementarity", the court said.
The ICC stressed that the Senussi decision had no bearing on the case against Kadhafi's son Seif al-Islam, who is still wanted in The Hague.
Countries including Kenya and Ivory Coast have asked to try their nationals in their own courts after they were charged by the ICC, but this is the first that the court has approved such a request.
Senussi's lawyer slammed the "shocking" decision, saying it condemned his client to "mob justice" and an "inevitable death penalty".
Kadhafi's former heir apparent and others including Senussi are accused of crimes during the revolt against Kadhafi two years ago.
Judges ruled that "the case against Senussi is currently subject to domestic proceedings conducted by the Libyan competent authorities and that Libya is willing and able genuinely to carry out such investigation".
The ICC's founding document, the Rome Statute, says that the ICC cannot carry out proceedings against a suspect if they are receiving a fair trial on similar charges in a domestic court.
The court said the decision could be appealed, which Senussi's lawyer Ben Emmerson said he would do.
"This is a shocking decision which we will immediately appeal," he wrote in an email to AFP.
Signup to our newsletter and follow us on Facebook and Twitter!
"There was overwhelming evidence before the Court that the Libyan justice system is close to collapse and that it is incapable of conducting fair trials of any Kadhafi-era officials," he wrote.
Libyan prisons are rife with systematic torture, abduction and assassination, Emmerson said, citing international monitors.
He cited the kidnapping on Wednesday by former rebels in Tripoli of Prime Minister Ali Zeidan, who was held for several hours before being released.
"The effect of this morning's decision is to condemn Senussi to face mob justice without even access to a lawyer, and in which the inevitable outcome is the death penalty."
The pre-trial chamber "found that the evidence submitted by Libya is sufficient to conclude that the Libyan and the ICC investigations cover the same case and that concrete and progressive steps are being undertaken by the domestic authorities in the proceedings against Senussi".
It also took into account the fact that Senussi is detained by Libyan state authorities, the quality of the evidence against him in the domestic case, and "efforts made to resolve certain issues in the justice system by recourse to international assistance".
A Tripoli court is to decide on October 24 whether to indict Seif al-Islam and Senussi, among 20 senior figures from Kadhafi's regime charged with killing protesters during the 2011 revolt that toppled him.
However, Seif remains in the hands of rebels in the western Libya town of Zintan, who have refused to hand him over to Tripoli authorities.
Moamer Kadhafi was captured and killed by rebels in his hometown of Sirte after an eight-month revolt against his four-decade rule backed by NATO air strikes.
Seif appeared before a Zintan court last month, which adjourned a separate trial until December 12.
Rights groups Amnesty International and Human Rights Watch had both urged the immediate handover of Seif and Senussi to the ICC to face war crimes charges.
Family members of those killed in the Abu Selim prison massacre of 1996 -- allegedly ordered by Senussi -- demonstrated outside the courtroom holding up pictures of those killed.