NEW DELHI—Prime Minister Narendra Modi and his brand of Hindu nationalist politics have weathered plenty of upheaval in India. His demonetization policy, which pulled almost 90% of the country’s currency out of circulation, led to long lines at ATMs and job losses. An overhaul of the agricultural sector sparked monthslong protests by farmers.

But, as a devastating wave of Covid-19 recedes in India, the simmering anger over the government’s handling of the crisis may pose the greatest test for the leader yet.

India’s coronavirus crisis—which hit global daily highs in April and May—has left millions infected and more than 360,000 dead. Overwhelmed hospitals throughout the country were forced to turn away patients after running out of beds and medical supplies. The crisis left few people in this country of more than 1.3 billion untouched, and many know severely ill people who struggled to get medical care.

Many—even some staunch supporters of Mr. Modi—blame the government for not being better prepared and for allowing mass religious and political gatherings as infections soared in the spring.

Until recently, a portrait of the prime minister hung in Varun Goel’s office, and his computer background depicted the bespectacled politician holding a lotus, the symbol of Mr. Modi’s ruling Bharatiya Janata Party.

Then Mr. Goel’s grandfather and uncle fell ill from Covid-19, and struggled to get even basic medical care as hospital after hospital turned them away. Both died in early May, due in part to a lack of access to medicine and delayed treatment, he said. Their family couldn’t even perform last rites because the bodies went directly from the hospital to the crematorium.

Mr. Goel, a 36-year-old wholesale dealer in India’s most populous state of Uttar Pradesh, says he will never vote for Mr. Modi’s party again. “He could have prevented this crisis. He didn’t care for us,” he said. “I will never forgive Modi for his neglect, for his indifference.”

Prime Minister Narendra Modi, addressing a gathering in Ahmedabad in March, has been criticized for allowing mass religious and political gatherings as infections soared in the spring.

Prime Minister Narendra Modi, addressing a gathering in Ahmedabad in March, has been criticized for allowing mass religious and political gatherings as infections soared in the spring.

Photo: amit dave/Reuters

Veteran political experts said the Covid-19 crisis has tarnished Mr. Modi’s aura of invincibility and sparked the kind of vocal public criticism that his government has tried to muzzle in recent years. Indians have taken to social media to rail against Mr. Modi and the BJP, with hashtags such as #ModiResign and #ModiFailsIndia going viral.

“There are few Indians right now who don’t know, within one degree of separation, somebody who died in the past year,” said Irfan Nooruddin, director of the South Asia Center at the Atlantic Council, a think tank based in Washington. The visuals beamed out from all corners of India—including people dying outside hospitals and dead bodies floating down the Ganges River—serve as a visceral punch reminding every Indian of how badly the government bungled the pandemic, he said.

“The notion that Modi could not be criticized, that you couldn’t really say anything against the government—that has been punctured,” he said. “And that I think is a big step.”

SHARE YOUR THOUGHTS

What do you think Prime Minister Modi’s political future looks like? Join the conversation below.

Even Indian media outlets, which in recent years have increasingly shied away from critical coverage of the government, have aggressively covered the breakdown of India’s healthcare system, Mr. Nooruddin said. The Supreme Court has also harshly criticized the government for failing to ensure hospitals had adequate oxygen and other medical care.

The opposition Congress party has repeatedly criticized Mr. Modi’s leadership and the government over the slow pace of vaccination and deficiencies in the country’s healthcare system. “The prime minister is also missing along with vaccines, oxygen and drugs,” opposition leader Rahul Gandhi tweeted last month.

The prime minister’s office didn’t respond to requests for comment.

Rajeev Chandrasekhar, a spokesman for the BJP, said Mr. Modi’s government has been working to protect the Indian people by ramping up healthcare capacity, working to get oxygen to the areas that need it and creating supply chains to deliver vaccines. He said the farmers’ protests contributed to the spread of the virus and that the state governments, which are largely responsible for regulating healthcare in India, were unprepared for the speed of the surge. To blame the prime minister, he said, “is simply not understanding how governance functions in India.”

A BJP spokesman said the monthslong farmers’ protests contributed to the spread of the virus.

A BJP spokesman said the monthslong farmers’ protests contributed to the spread of the virus.

Photo: Dinesh Joshi/Associated Press

Mr. Modi and his party have a devoted base of supporters who say they are standing behind him. Karthik Karnala, a 40-year-old dentist in Bangalore, lost his father to Covid-19 last year and saw his brother hospitalized with the virus.

Mr. Karnala, who has long voted for the BJP, said he doesn’t blame Mr. Modi for his family’s tragedies. The increased transmissibility of the variants and the huge spike in cases were impossible to predict, he said.

“The way this is spreading, it’s been totally different,” he said, adding that he plans to keep voting for Mr. Modi’s party. “I’m pretty sure any government would have handled it the way the current government is handling it.”

Ramesh Jha, a 50-year-old local BJP worker, said many villagers in his part of Madhubani district in the eastern state of Bihar felt largely abandoned by the government after struggling to get proper treatment for Covid-19. But their anger has been directed at the local bureaucracy instead of the prime minister, he said.

India's Covid-19 crisis has resulted in record numbers of cases and deaths. WSJ breaks down the chain of events that led to the fastest-growing wave of infection since the pandemic started, and what it means for the world. Photo: Samuel Rajkumar/Reuters (Video from 5/19/21)

Many people were appreciative of the government’s past efforts to expand access to financial services by helping millions of poor people in rural India open bank accounts, which came in handy during the pandemic. “People were able to get their pensions and cash subsidies directly from their bank accounts and use that money in their times of need,” he said. “People are mostly happy with Prime Minister Modi.”

One recent survey showed that Mr. Modi’s approval ratings have sunk to 31%, the lowest level since polling began in August 2019, according to Morning Consult, a data intelligence company that tracks a dozen global leaders. A separate survey from LocalCircles, a New Delhi-based consulting firm, showed that 51% of Indian citizens rated Mr. Modi’s government as meeting or exceeding expectations, a drop from 61% in May 2020 and 75% in March 2019.

One thing that will help insulate Mr. Modi from the fallout is time, with national elections three years away. Collective anger—and memories—may fade by the time he faces re-election. To mount a strong challenge, the opposition would have to keep the momentum going by harnessing the Covid-19 crisis to win state elections in the run-up to national elections in 2024. Many of the seats that the BJP gained in the previous national elections, experts said, were won by slim margins that could be flipped.

State elections next year in Uttar Pradesh will serve as a barometer of public sentiment, Mr. Nooruddin said. “That’s going to be the first true test of whether or not the mishandling of the Covid pandemic has domestic political costs,” he said. If a coalition of opposition parties can defeat BJP stalwart and Chief Minister Yogi Adityanath, he added, that will indicate something has changed.

Even voters who have defected from the pro-Modi camp said they doubt the prime minister will suffer long-term costs from the pandemic.

People were gasping for breath, and the government went into hiding. We feel betrayed.

— Saurabh Kumar Aeran

Saurabh Kumar Aeran, a 42-year-old garment merchant from the city of Varanasi in Uttar Pradesh, lost his father to Covid-19 last month. A cousin is still clinging to life in a hospital.

Local hospitals and pharmacies were so overwhelmed with patients that Mr. Aeran said he had to stand in line for hours to get oxygen refills and drive long distances to get medicine for sick family members.

Mr. Aeran said he once revered Mr. Modi for his no-nonsense working style, and voted for his party in the past two elections. But the inability of the government to help those suffering from coronavirus has quashed his admiration.

“People were gasping for breath, and the government went into hiding,” he said. “We feel betrayed.”

He has no desire to vote for the BJP in future elections. But Mr. Aeran said he doesn’t know if opposition parties have the ability to truly challenge Mr. Modi’s rule.

“It’s unfortunate there are hardly any political choices,” he said.

–Krishna Pokharel contributed to this article.

Write to Shan Li at shan.li@wsj.com and Vibhuti Agarwal at vibhuti.agarwal@wsj.com