India's Supreme Court has ruled that citizens have a constitutional right to privacy, a landmark verdict that could derail a controversial biometric identification programme that the government is pushing on its people.

A nine-judge bench ruled unanimously on Thursday that the right to privacy was "protected as an intrinsic part of Article 21 that protects life and liberty", in a case that challenges Prime Minister Narendra Modi's decision to make biometric ID cards, known as Aadhaar, mandatory.

Aadhaar, which has recorded the fingerprints and iris scans of more than one billion Indians, was set up as a voluntary scheme to streamline benefit payments to millions of poor people and cut fraud.

But in recent years it has become compulsory for a growing number of services, including opening a bank account or paying taxes.

Opponents have argued that its use for essential services means the right to privacy is increasingly being violated.

Activists say Aadhaar links enough data to create a comprehensive profile of a person's spending habits, their friends and acquaintances, the property they own, and a trove of other information.

'Litmus test' of Indian democracy

Lawyer Prashant Bhushan told reporters outside the court that the judgement would likely impact the programme.

"Any fundamental right is subject to reasonable restrictions by law. Whether the Aadhaar Act imposes unreasonable restrictions will have to be examined," he said.

Modi's government has rejected suggestions that the programme, set up in 2009, poses a threat to civil liberties, despite personal data being leaked in security breaches.

In May, security researchers at the Centre for Internet and Society reported that the information of as many as 135 million people had been leaked online.

The Unique Identification Authority of India (UIDAI), the agency that governs Aadhaar, has repeatedly said that its data is secure.

During the hearings, the Supreme Court bench recognised the risk of personal information being misused, and the challenge of protecting such private data in the internet era.

But the judges also acknowledged there must be restrictions within reason on individual privacy.

Constitutional law scholars had said the case would be a litmus test of Indian democracy, with potentially far-reaching consequences if individuals were allowed to challenge laws on the basis of individual rights.