India's Supreme Court has ruled that citizens have a fundamental right to privacy, in a landmark judgement.
The judges ruled the right to privacy was "an intrinsic part of Article 21 that protects life and liberty".
The ruling has implications for the government's vast biometric ID scheme, covering access to benefits, bank accounts and payment of taxes.
Rights groups are concerned personal data could be misused. The authorities want registration to be compulsory.
The verdict overturns two previous rulings by the top court which said that privacy was not a fundamental right.
The nine-judge bench, comprising all the sitting judges in the Supreme Court, was necessary because one of the earlier rulings, made in 1954, was delivered by an eight-judge bench.
Analysis by Geeta Pandey, BBC News, Delhi
The Supreme Court verdict is a huge setback for the government which has insisted that privacy is not an inalienable fundamental right guaranteed under the constitution.
When the Aadhaar database was launched, the authorities said it would be a voluntary scheme which would help them weed out corruption while passing on welfare benefits to the most needy citizens.
But in the past couple of years, it has been made mandatory for filing tax returns, opening bank accounts, securing loans, buying and selling property or even making purchases of 50,000 rupees ($780; £610) and above.
The petitioners had said this would help the authorities create a comprehensive profile of a person's spending habits and expressed apprehension that this data could be misused by a government which does not believe in people's right to privacy.
During the hearing of the case, the government's lawyers had told the court that citizens did not have absolute right over their bodies which meant that people could be forced to give their biometrics.
Alarmed citizens can now breathe a sigh of relief - as one legal expert said, Thursday's order recognises the right of a citizen to be the master of his body and mind.
- What will landmark ruling mean?
- Aadhaar: Are a billion identities at risk?
- Will India's identity number really be a game changer?
Speaking to reporters outside court, lawyer Prashant Bhushan, who represented the petitioners, described the ruling as "historic".
He said that a smaller bench would now look into the validity of the Aadhaar scheme, the largest biometric identity scheme in the world.
Aadhaar, which means foundation, started out as a voluntary programme to help tackle benefit fraud.
But recently it has been made mandatory for access to welfare schemes.
The government says that Aadhaar has cut waste, removed fakes, curbed corruption and made substantial savings.
Advocates of the scheme have also argued that the portable identity number is a boon to millions of Indians who do not possess any other form of ID.
UN data shows that many births among people belonging to the poorest segments of society are not registered.
In its judgment, the Supreme Court also criticised a previous ruling by the top court that reinstituted a law criminalising homosexuality, saying that "discrimination against an individual on the basis of sexual orientation is deeply offensive to the dignity and self-worth of the individual".
A decision on a petition against the law will be made later, it said.
The statement is expected to provide a huge boost to petitioners for LGBT rights in India.
Thursday's ruling comes two days after the court said instant divorce, practiced among some Muslims in the country, was unconstitutional.
It is the last major case due to be heard before sitting Chief Justice JS Khehar retires on Friday.
The government has taken contradictory stands on the issue of privacy.
In previous cases, it said that privacy was protected by the constitution, but argued otherwise in the Aadhaar case.
Some quick facts on Aadhaar
- Aadhaar is the world's largest biometric ID card programme.
- Over the past eight years, the government has collected fingerprints and iris scans from more than a billion citizens and stored them in a high security data centre.
- Indians are provided with a 12-digit random number issued by the Unique Identification Authority of India (UIDAI).
- Since its inception, activists have expressed concern over the security of data, with recent breaches linked to Aadhaar where individuals have been accused of illegally storing biometric information.
- Critics also believe that the Aadhaar card scheme contains enough data to create a profile of a person's financial habits, property they own and other private information.