Image copyright MANSI THAPLIYAL Image caption Over a billion Indians have already registered and obtained their unique identity card

The idea of getting biometric data - fingerprint and iris scans - of a billion people would seem to be an impossibly complex task.

But the Indian government is in the final stages of enrolling all of its citizens in the world's largest ID system. Siva Parameswaran of the BBC's Tamil Service finds out how they did it.

Starting out

The system is known as Aadhaar, which means foundation.

It started as a voluntary programme to help tackle benefit fraud - and is now described as "the largest and most sophisticated ID database in the world".

Once the government committed to it - with the hope that it would be able to use it to raise more taxes, register voters and identify the hundreds of millions of drivers using false licences - it began taking the details of people whenever they came into contact with state agencies.

Biometric details were - and continue to be - recorded in schools, hospitals, childcare centres and special camps.

Aadhaar's website claims that 90% of Indians are now registered, though this figure is disputed by activists.

How does it work?

Aadhaar, or a Unique Identification Number, is allocated to every Indian and remains their national identity document forever.

Image copyright MANSI THAPLIYAL Image caption Activists say the recording of biometrics breaches an individual's fundamental right to privacy

It has become virtually impossible to do anything financial without it - such as opening a bank account or filing a tax return.

However, the scheme does in theory remain voluntary, and the highest court is hearing a petition on making it compulsory; the final judgement is awaited.

Why is it controversial?

When Indian cricket star MS Dhoni accidentally had his number published on Twitter in March 2017, it exposed the many worries Indians have about having one single code so crucial to many aspects of their lives.

Image copyright Mansi Thapliyal Image caption Ten fingerprints, two iris and facial photographs are taken for issue of the unique identity card

One fear is that it will become a method of financial surveillance.

Questions have also been raised about the moral authority of the government to force citizens to share biometric data. Activists say it is breach of the UN's Fundamental Right of Privacy.

People's Union for Civil Liberties activist Suresh told the BBC that citizens were not briefed about the implications of sharing their private data, but did so as they feared they would not be able to carry out financial transactions, gain admission to educational institutions and access subsidised food products from government-run shops.

"There is no guarantee that the data will not be leaked and also no accountability structure is in place," Suresh explained.

Activists also fear that it will be impossible to ensure that data will not be misused or abused, though authorities told the BBC that all the biometric data was well protected.

Antiquated laws?

Investigative reporter Saikat Datta of the Observer Research Foundation says that Aadhaar has been converted into "the world's biggest surveillance engine."

And while India has a billion phones, laws for protecting the data on those phones are antiquated.

When the National Identification Authority of India Bill was introduced in 2016, it was sent to a special committee of the Parliament, whose members made scathing remarks about the project.

This committee recommended that enactment of legislation on data protection and privacy law was a "prerequisite" for the Aadhaar scheme.

Image copyright Twitter / @narendramodi Image caption Narendra Modi strongly criticised the previous government on the project

Indian Prime Minister Narendra Modi, also strongly criticised the scheme in 2014.

But Aadhaar's authorities say their data protection goes far beyond what is required in the law.