Bake sales on Instagram. Online fund-raisers involving Hollywood celebrities. Pledges of aid from companies like Mastercard and Google. A middle-of-the-night flight by a FedEx cargo plane transporting thousands of oxygen concentrators and masks.

India’s devastating surge in Covid-19 cases has galvanized corporations, nonprofit organizations and individuals in the United States into raising millions of dollars and sending medical supplies to the nation of 1.4 billion.

But a sweeping change to India’s decades-old law governing foreign donations is choking off foreign aid just when the country needs it desperately. The amendment, passed by the government of Prime Minister Narendra Modi in September with little warning, limits international charities that donate to local nonprofits.

The effect is far reaching. Almost overnight, the amendment gutted a reliable source of funding for tens of thousands of nongovernmental organizations, or NGOs, that were already stretched thin by the pandemic. It prompted international charities to cut back giving that supported local efforts — and supplemented the government’s work — in fields such as health, education and gender.

The amended law has forced newly formed charities to rush to find NGOs that can accept their donations without tripping legal wires. And it has smothered nonprofits in red tape: To receive foreign funds, charities must get affidavits and notary stamps and open bank accounts with the State Bank of India, which is government-owned.