A bench of justices A K Patnaik and V Gopala Gowda quashed the orders of the trial court and the Gujarat High Court by which three persons were awarded death sentence.
Other convicts were facing varying jail terms from life sentence to 10 years for the September 24, 2002 terrorist attack on the Akshardham temple in Gandhinagar.
While a local youth from Dariapur in the city Mohammed Salim Shaikh was sentenced to life imprisonment, Abdulmiyan Qadri was given a 10-year term and Altaf Hussain was sentenced to imprisonment for five years.
The apex court ordered their release from jail "forthwith" if they are not convicted in any other case.
More From This Section
The bench pulled up the Gujarat Police for shoddy its investigation in the case which concerned national security and integrity of the nation.
The attackers using automatic weapons and hand grenades had killed 32 people, including 28 temple visitors, three commandos, including one from NSG, and a constable of the State Reserve Police (SRP).