NAIROBI, Kenya — For all his 73 years, Ahmed Khalil Kafe lived as a citizen of Kenya.

Born in the capital, Nairobi, Mr. Kafe worked as a police officer and even served with the presidential guard, court documents show. But last April, when he tried to register for a national ID in the giant biometric database that President Uhuru Kenyatta has said will be the “single source of truth” on Kenya’s population, he was turned away.

Now, Mr. Kafe said, “My life is in limbo.”

In an ambitious new initiative, the Kenyan government is planning to assign each citizen a unique identification number that will be required to go to school, get health care and housing, register to vote, get married and obtain a driver’s license, bank account and even a mobile phone number. In preparation, nearly 40 million Kenyans have already had their fingerprints and faces scanned by a new biometric system that ramped up last spring.

But millions of ethnic, racial and religious minorities — like Mr. Kafe, who is a Kenyan of Nubian descent — are running into obstacles and facing additional scrutiny when they apply for the documents required to get a biometric ID. Many have faced outright rejection.

Now the biometric ID plan is being challenged in court by civil rights organizations, which say it is disenfranchising members of minority groups. The high court is expected to rule Thursday on whether the project is constitutional.