Iran has freed 54,000 prisoners amid fears that the deadly coronavirus could spread like wildfire in its crowded jails.

An Iranian judiciary spokesman said Tuesday that the inmates were granted furlough — meaning they are supposed to return at some point — after testing negative for the virus, the BBC reported. The prisoners also had to post bail, the official said.

The country says it has had more than 2,300 confirmed cases of the virus and 77 deaths. The judicial rep wouldn’t say whether any of those who died were prisoners.

The development came as it was revealed that the country’s head of emergency services has contracted the virus.

Of the 290 members of Iran’s parliament, 23 also have been reported positive.

A top aide to Supreme Leader Ayatollah Ali Khamenei died of the coronavirus Monday.