DAKAR, Senegal - Chad's former dictator Hissene Habre was found guilty and sentenced to life imprisonment for abuses during his time in power, Judge Gberdao Gustave Kam said Monday at the end of the trial that began in July 2015.

Cheers, whoops of joy and tears greeted the judge's ruling from scores of Habre's former prisoners who hugged each other in the courtroom.

Habre's trial by the Extraordinary African Chambers in the Senegalese courts began in July last year. It is the first trial in which the courts of one country are prosecuting the former ruler of another for alleged human rights crimes. More than 90 witnesses testified.

Get Breaking News Delivered to Your Inbox

Habre was convicted of being responsible for thousands of deaths and tortures in prisons during his rule from 1982 to 1990. A 1992 Chadian Truth Commission accused Habre's government of systematic torture, saying that 40,000 people died during his rule. It placed particular blame on his political police force.

The ex-dictator, who has lived in Senegal's capital, Dakar, since fleeing Chad in 1990, has denounced his trial as being politically motivated. He and his supporters have disrupted proceedings several times with shouting and singing. He refused legal representation but the court appointed him Senegalese lawyers.

Chad's government, led by President Idriss Deby, who served as Habre's military adviser before pushing him from power, supported the trial.

The trial of Habre was forged by many of those who had been jailed by Habre's government and who have campaigned for his prosecution for more than 15 years.

Security personnel surround former Chadian dictator Hissene Habre inside the court in Dakar, Senegal, Monday, July 20, 2015. AP

"This case was not started by a prosecutor in the Hague, or by the Security Council. The architects, the visionaries of this case, are the Chadian victims themselves and their supporters," said Reed Brody, counsel for Human Rights Watch who has been working on the case since 2000. The work by the survivors to bring Habre to justice influenced all aspects of the trial including the way the charges were framed, he said.

Habre was first indicted by a Senegalese judge in 2000, but legal twists and turns over a decade saw the case go to Belgium and then finally back to Senegal after unwavering pursuit by the survivors.

In 2001, the police force's archives were discovered on the floor of its headquarters in Chad, records which went back to Habre's rule and mention more than 12,000 victims of Chad's detention network.

The extraordinary court was formed by Senegal and the African Union to try Habre for the crimes that took place during his rule.

A second set of hearings on damages for the more than 4,000 registered civil parties will take place in the coming days. The defense has about 15 days to appeal. If they do, an appeals court must be set up.