India's highest court has upheld the legality of a controversial biometric identity database.

All residents of India must hand over personal details including iris scans and fingerprints to the giant Aadhaar database, if they want basic services like food rations.

Indians even have to give over their personal identifiers if they want to get a mobile number, bank account or passport.

“It seeks to tether every resident of India to an electronic leash,” says Shyam Divan, a lawyer arguing against making the system mandatory.

“This leash is connected to a central database that's designed to track transactions across the life of the citizen.

“This record will enable the state to profile citizens, track their movements, assess their habits and silently influence their behaviour.”

Lawyers are also concerned that the system is extremely vulnerable to security breaches.

An Indian newspaper earlier this year purchased the personal data of some of the billion people in the system by paying hackers just $10.

The Indian Government filed criminal charges against the newspaper.

A new ruling by India's Supreme Court has found the biometric scheme is legal, but sought to limit its scope.

Indian residents had been made to link their private bank accounts, mobile numbers and even school admissions to their profile in the government database.

The court ruled those regulations are unconstitutional.

The finding comes too late for hundreds of millions who have already linked such accounts to the government database.