Last week, a powerful Iranian general went on state-run television to make an extraordinary claim: His elite military unit, the Revolutionary Guard Corps, possessed a machine that could detect the coronavirus from 100 meters away.

Gen. Hossein Salami displayed the “Mustaan,” a handheld gizmo resembling a small satellite dish, and said its 80 percent success rate would help end the country’s coronavirus ordeal. He called it “an astonishing scientific phenomenon.”

Iranian public health officials downplayed the claim, which was widely ridiculed on social media. Yet Salami’s TV pitch was merely a more theatrical rendering of a message that Iran’s hard-line rulers have been seeking to deliver in recent weeks. The country’s elite security force is aggressively promoting itself as Iran’s true guardian during the pandemic, a provider of medical treatment, clinics, relief aid and — occasionally — even dubious “cures” and fixes.

Iran has been among the countries hardest hit by the coronavirus, with an official death toll of more than 5,000, a figure that many outside experts think vastly understates the virus’s true impact. But while the outbreak continues to ravage the country and its economy, the Revolutionary Guard and its allies are seizing opportunities amid the crisis to expand their already powerful base while also cracking down on public displays of discontent, Western intelligence officials and Iran analysts said.

The moves to consolidate power follow a string of recent crises — including the downing of a Ukrainian civilian airliner — that challenged the Revolutionary Guard’s reputation both at home and abroad, and had appeared to put the force on the back foot.

But now, with the explicit support of the supreme leader, Ayatollah Ali Khamenei, the army, Revolutionary Guard and its paramilitary Basij force have taken command of the country’s response to the pandemic, including the construction of hospitals and the enforcement of quarantine laws.

U.S. and European officials say that the security branches’ bid for greater dominance during the crisis appears intended, in part, to discredit President Hassan Rouhani, whose more moderate government has been faulted by conservative leaders for a bungled early response to the pandemic.

The Revolutionary Guard’s new role could leave Iran more firmly in the hands of virulently anti-Western elements who favor a more confrontational stance toward its adversaries, including the United States and Israel, U.S. and European analysts say.

“Covid-19 has accelerated a trend that began long ago, which is Iran’s transition from clerical autocracy to military autocracy,” said Karim Sadjadpour, a Middle East expert and senior fellow at the Carnegie Endowment for International Peace, a Washington think tank.

“Nobody is saying ‘no’ to the Revolutionary Guard these days,” Sadjadpour said.

The Revolutionary Guard’s power play comes at a time when the elite force is itself facing extreme financial and other pressures.

The Revolutionary Guard’s most prominent commander, Maj. Gen. Qasem Soleimani, was killed in a U.S. drone strike in January, and its ranks have been hit especially hard by the virus, which has sickened or killed numerous leaders and soldiers.

But the economic damage from the outbreak has delivered a far greater blow, according to U.S. and European intelligence officials who spoke on the condition of anonymity to discuss classified assessments.

Iran’s economy, already battered by U.S. sanctions, is now reeling from the virus’s fallout. Last month, officials requested a $5 billion emergency loan from the International Monetary Fund to help offset the impact, prompting an immediate threat by the Trump administration to use its leverage at the IMF to block the request. Iran’s economic affairs and finance minister said that the outbreak could cost the country as much as 15 percent of its gross domestic product.

Many of the Revolutionary Guard’s financial enterprises — including in Iran’s construction, automotive and oil and gas industries — have also taken direct hits, and a sudden cash shortage is beginning to fray relations with the group’s alliance of pro-Iranian militias from Lebanon, Syria and Yemen.

The Revolutionary Guard derives much of its income from oil, most of it smuggled and sold on the black market in defiance of international sanctions. Iran’s economy already was in free fall due in part to mismanagement and falling oil prices, as well as U.S. trade restrictions. In October, the IMF predicted the Iranian economy would shrink by more than 9 percent this year.

The global spread of the virus accelerated the decline by triggering a crash in oil markets worldwide.

As a result, the Revolutionary Guard and its foreign operations wing, the Quds Force, have been forced to curtail or freeze some of their activities, including in Syria, where Iran-backed militias are helping President Bashar al-Assad reclaim the last rebel strongholds in that country’s civil war. Social media postings in recent weeks have depicted fighters being redeployed to factories to sew surgical masks and gowns.

Revolutionary Guard leaders have even turned to its militia clients to ask for financial help, U.S. and European officials said. At least some of the militias appear to be chafing under the new conditions.

“They don’t have as much cash to give away,” said a European intelligence official. Militias in Lebanon and other countries have been asked to “do fundraisers and funnel money back to the Iranian security service structure,” the official said.

With oil profits drying up, the group’s leaders are scrambling to find new sources of revenue, U.S. and European officials and analysts said.

“They have increased their efforts in smuggling and other criminal [activities] to make money,” said a Europe-based Iran analyst, who also spoke on the condition of anonymity to discuss sensitive assessments. “Iran was under a lot of stress due to the sanctions. Now oil prices as well as covid-19 are hitting them very hard.”

At home, the pandemic has created new opportunities. Inside Iran, the Revolutionary Guard commands the Basij force, a 90,000-strong volunteer paramilitary group that Revolutionary Guard leaders have used as muscle to enforce quarantines as well as build treatment centers. The volunteers have traditionally been deployed as shock troops to quash protests in times of unrest.

In recent weeks, the Revolutionary Guard’s media wing has promoted images of soldiers and Basij members performing tasks such as screening patients, disinfecting public spaces and setting up temporary hospitals.

Last month, officials in Tehran approved a substantial increase in defense and law enforcement spending, including funds earmarked both for the Revolutionary Guard and Basij volunteers.

“It is possible that some of [the] increased spending will be directed toward countering the pandemic, such as through funding the construction of temporary medical centers,” said Henry Rome, an Iran analyst at Eurasia Group.

“But the budget decision, combined with the recent attacks on U.S. forces in Iraq, sends a powerful signal to the U.S. and others that Iran will not back away from domestic repression or foreign intervention despite the severe public health crisis,” he said.

Last week, Khamenei assigned the Revolutionary Guard yet another responsibility: disbursing aid to millions of needy Iranians. Salami formally launched the “Imam Hassan” center at a ceremony last Tuesday, saying the Revolutionary Guard and Basij forces would distribute aid packages to 3.5 million citizens. “Our rising capabilities are showing brilliance and amazing distinction compared to the developed countries,” the state-run Mehr News Agency quoted Salami as saying.

Salami unveiled the Mustaan virus-detection device at a separate event with mask-wearing Basij leaders the following day. A Basij spokesman said the device was invented by the Basij and was designed to spot the coronavirus anywhere within a 100-meter radius in as little as five seconds.

After the demonstration, Iran’s government-run Ministry of Health and Medical Education released a statement noting the Mustaan had not been officially tested or approved.

Saeid Golkar, a University of Tennessee at Chattanooga assistant professor and expert on Iran’s elite security forces, said such events show that the Revolutionary Guard perceives the crisis as a serious threat in need of magical fixes.

“The possibility of political instability in Iran is increasing rapidly,” said Golkar, author of a 2015 book on the Basij. “They realize that they need to find ways to gain support, especially among the poor and lower classes, the people who have mostly likely lost their jobs.”