NEW DELHI — India counted votes for state elections on Sunday as it announced 3,689 deaths from covid-19 in the previous 24 hours — a grim national record.

Elections held in four states and a union territory in late March and April coincided with the start of a deadly second wave of the coronavirus that has crushed the country’s creaky health-care system. More than 390,000 new infections were announced Sunday.

The decision to hold elections over the past month while new cases mushroomed has drawn scrutiny here. The Madras High Court went as far as to slam the country’s Election Commission for not stopping political rallies that flouted coronavirus protocols. Chief Justice Sanjib Banerjee called the commission “singularly responsible” for the surge in cases.

Prime Minister Narendra Modi held several massive campaign rallies in the past month attended by tens of thousands of people in the eastern state of West Bengal, where his party, the Bharatiya Janata Party, or the BJP, was in a close race with an opposition party led by a woman. Modi and his powerful deputy, Amit Shah, addressed more than 50 rallies in Bengal, according to NDTV.

By evening, it was clear Modi’s party had lost the bitterly fought election battle. The BJP was on track to lose in two other south Indian states where they weren’t in the reckoning. The party is set to retain power in the state of Assam.

Critics say Modi sent the wrong message by holding rallies at a time when India was on its way to becoming the worst-affected country in the world by the pandemic, but the elections might be only a limited test of the impact of the unfolding crisis on his support.

Mamata Banerjee, the chief minister of Bengal, known for her streetfighter reputation, asked her supporters to remain at home. “Covid is my first priority,” Bannerjee said in her victory speech. The state capital, Kolkata, has in recent days seen positive test rates climb; now 1 in 2 people tested are found to be positive.

Anger at the Modi government, criticized for missteps from allowing a large-scale Hindu festival in northern India that drew millions of devotees to not preparing the country for the expected second wave, is at its highest level since he swept to power in 2014. But analyst Milan Vaishnav said the political consequences might be limited, because Modi has “proven to be a master of reinventing his public persona.”

The teachers association in Uttar Pradesh, the country’s most populous state, says village council elections in April resulted in the deaths of more than 700 government teaching staff members deployed on poll duty, an alarming indication of the worsening situation in rural areas that had been spared in the first wave.

The situation in India’s capital remained desperate; hospitals have struggled with oxygen shortages for more than a week. Dozens of covid patients in hospitals have died in recent days as supplies have run out. On Sunday, a children’s hospital took to Twitter to plead for fresh supplies.

“Enough is enough,” said the High Court in Delhi on Saturday, slamming the central government for not providing adequate oxygen supplies to the city. Elsewhere in the city, parks and parking lots have been turned into makeshift crematoriums to handle the high volume of dead bodies.

On Twitter, citizen volunteers were overwhelmed with distressed pleas for hospital beds, oxygen cylinders or medicine needs.

The desperation has spread to the Indian diaspora in the United States, where people are struggling to help family and friends back in India scrambling to find health care, as life increasingly returns to normal in America.

A glimmer of hope came from the financial capital of Mumbai, one of the worst-hit cities. Its positivity rate fell to single digits at just under 10 percent, half of what it was at the beginning of April. The city has been commended for successfully triaging patients and enforcing strict lockdown measures.

Randeep Guleria, a physician who is part of the national coronavirus task force, said the country had been “caught off-guard” by the ferocity of the second wave, suggesting an “aggressive lockdown” was the way forward. Last year, India imposed a harsh lockdown that shut the country down on four hours’ notice. It helped stem the spread of the virus but wreaked havoc on the economy and left millions of migrant workers trapped in cities without jobs.

Nearly a dozen states have enforced local restrictions, but the country has avoided another national lockdown. In Delhi, authorities have extended the two-week lockdown for another week, shutting down all activities except essential services such as food and medical supplies.

The state of Haryana, which borders Delhi, on Sunday announced a full shutdown for a week. Uttar Pradesh has instituted a weekend lockdown in a bid to curb the spread. Schools across the country remain closed but people are allowed to travel to vaccination sites.

The vaccination drive on Saturday, which was open to everyone above the age of 18, sputtered to a halt in many states on its first day due to vaccine shortages. Several states asked citizens who had registered to receive a jab to stay home, saying they would prioritize those who were due to receive the second shot.

In an interview with the Times of London, Adar Poonawalla, the head of the Serum Institute, the world’s largest vaccine manufacturer by volume, described receiving threatening calls from politicians as his company struggles to meet India’s vaccine demands.

“The level of expectation and aggression is really unprecedented. It’s overwhelming,” he said. Poonawalla flew to London with his family recently, hours before flights were barred by Britain from India.

“I’m staying here an extended time because I don’t want to go back to that situation,” Poonawalla said. “Everything falls on my shoulders, but I can’t do it alone.”

The interview set off a storm of criticism against Poonawalla; he later tweeted that he would be returning to India in a few days.

India, which donated millions of doses to its poorer neighbors and other countries in the months preceding the crisis, has temporarily halted all vaccine exports as it struggles to ramp up its own vaccination program.

While India has already administered 153 million doses, they have covered only a fraction of the nation’s 1.3 billion people. Some 27 million have been fully vaccinated so far.