The BBC's Sanjoy Majumder in Delhi says the court judgement comes as a major setback for India's law enforcement agencies and raises serious questions about the process of gathering evidence in criminal investigations.

Anti-terror law

The Supreme Court also upheld the acquittals of a Delhi college professor, SAR Geelani, and the wife of Shaukat Hussain, Afsan Guru.

Evidence shows beyond reasonable doubt that Afzal was a party to the conspiracy

Supreme Court judgement

The pair were acquitted due to lack of evidence. He had originally been sentenced to death, and she had been given five years in jail.

Afzal, Hussain and Mr Geelani are all Kashmiri and were arrested in Indian-administered Kashmir the day after the attack.

The court judgement said Afzal had done everything he could "to help the terrorists in their nefarious act".

"Evidence shows beyond reasonable doubt that Afzal was a party to the conspiracy and had a nexus with the deceased terrorists."

PARLIAMENT RAID

December 2001 - four arrested day after gun battle, accused of aiding attackers

December 2002 - three of the four given death sentences, one a prison term

October 2003 - High Court overturns two convictions, upholds two death sentences

Jan 2004 - Supreme Court stays both executions

August 2005 - both acquittals and one death sentence upheld, the other commuted to jail