MUMBAI, India — In a landmark ruling on Wednesday, India’s Supreme Court placed strict limits on the government’s national biometric identity system while also finding that the sweeping program did not fundamentally violate the privacy rights of the country’s 1.3 billion residents.

A five-justice panel of the court decided by 4-1 to approve the use of the program, called Aadhaar, for matters involving the public purse, such as the distribution of food rations and other government benefits and the collection of income taxes.

But the panel struck down Prime Minister Narendra Modi’s efforts to require the digital ID for other purposes, including verifying the identity of students taking exams, and established new protections meant to prevent the government from misusing the data in the name of national security.

The justices also threw out a powerful provision in the 2016 Aadhaar Act that had allowed private companies like banks and cellphone companies — sometimes at the government’s behest — to use the ID to verify customer identities. That was at least a temporary blow to the dreams of technology billionaires, like Nandan Nilekani and Vinod Khosla, who saw the system as crucial to a new generation of digital businesses like online vehicle insurance and pre-employment background checks.