The prosecution chamber of the Dakar Court of Appeals declared itself on Friday "not competent" to rule whether to issue an extradition order for 63-year-old Habre, in exile in Senegal for 15 years.
In the wake of the hearing, Habre was on his way home, according to one of his lawyers, after being detained in a special wing of a Dakar hospital.
"Hissene Habre must be judged as a head of state and must benefit from privilege," according to a ruling read out by judge Lamine Coulibaly to the packed courtroom that was greeted with both cheers and disbelief.
The court's task had not been to consider the accusations against Habre but to rule on the extradition request itself.
"We were quite surprised; but the main idea is that the arrest warrant is still valid," Olivier Bercault, a lawyer with Human Rights Watch, said.
"We are not sure why they decided they did not have jurisdiction to decide whether there were legal grounds for his extradition."
There was no immediate indication as to the next step forward for the process, Bercault said, with potential options including a new petition to the appeals court or possibly through the High Court.
However a judge on the Appeals Court, who wished to remain anonymous, said their decision brought an end to the extradition application as this court was the "last resort".
"Hissene Habre must be judged as a head of state and must benefit from privilege"
Ruling by the Dakar Court of Appeals
He said Belgium would need to file a new application and arrest warrant if it "really wanted to insist" on the extradition and that crimes committed by heads of state must be heard by the High Court which has jurisdiction under the Senegalese constitution.
According to defence lawyers for Habre the ruling was the first step towards freedom for their client, whose side of the courtroom was stacked with family members, friends and supporters.
"In terms of justice, he will be freed today (based on the ruling)," attorney Doudou Ndoye told reporters.
Habre was arrested on 15 November on an international arrest warrant in connection with actions by Chadian intelligence services during his rule including "arbitrary and collective arrests, mass murders and systematic acts of torture, directed notably against members of certain ethnic groups".
An official truth commission report in 1992 accused Habre's regime of committing some 40,000 political murders - among whom only 4000 victims have been officially named.
Habre was overthrown in a coup in 1990.