She said President Macky Sall, who was elected in March, has stated publicly that he intends to prosecute Mr. Habré.

He would be tried under Senegalese law by a panel of local and African judges set up in agreement with the African Union, an arrangement Ms. Touré called “a novelty in international law.”

A human rights lawyer who had previously worked for the United Nations, Ms. Touré said that although she was sorry to see a ruling against her country, it was an important step in human rights law.

Neither Mr. Habré nor his lawyer could be reached for comment, but his comfortable exile may be coming to an end. Although Chad is among the world’s poorest nations, Mr. Habre is said to have acquired a sizable fortune. The Chad Truth Commission said in 1992 that even during the final days of his rule, he stole more than $11 million from the country’s treasury and central bank.

Mr. Habré came to power reportedly backed by covert support from the United States, during the Reagan administration, and other Western countries that wanted a counterweight in Chad to its troublemaking neighbor, Libya, at the time under the leadership of Col. Muammar el-Qaddafi. The truth commission said Mr. Habré’s government had killed up to 40,000 opponents and tortured many others.

A court in Chad has sentenced him to death in absentia, and courts in Belgium and Senegal have sentenced him for crimes against humanity, including torture, but Senegalese politicians presented numerous obstacles to his prosecution. It was Belgium that filed the case against Senegal at the court in The Hague, arguing that he should either be tried in Senegal or extradited to Belgium. It denounced Senegal for turning down four Belgian extradition requests.

Among the victims of Mr. Habré’s secret police was Souleymane Guengueng, who attended the court hearings this year. He said he had nearly died during almost three years in Mr. Habré’s prisons before founding an association of victims to seek justice. “This is one of the best days of my life,” Mr. Guengueng said. “The world’s highest court said today that we have a right to see justice done.”