Four prisoners have died and 61 have been injured following a major fire at Iran’s notorious Evin prison, according to an Iranian state news agency.
Sources inside the prison – which is known for housing political prisoners – have told media Persian the number of casualties is higher.
Videos shared online showed flames and smoke at the site in Tehran, and gunshots and explosions could be heard.
Iran has been gripped for weeks by anti-government protests.
Four of those who were injured are in critical condition, Iran’s Mizan News agency has said.
It is not yet known whether the situation at the prison is linked to the recent demonstrations, BBC Persian’s Rana Rahimpour says.
But this could easily be the case, Rana says, as hundreds of the protesters have been sent to Evin.
Those protests first erupted last month after the death of 22-year-old Kurdish Iranian Mahsa Amini in police custody. Officials said she died of a heart attack, but her family disputed this, saying she was beaten by morality police.
State media has suggested the events in Evin prison are not linked to the ongoing protests, quoting an official who blamed “criminal elements” for the fire.
Speaking from inside the prison, Tehran’s governor told state TV that there was a riot in a wing of the prison housing petty criminals.
While Iran’s Mizan News has said the injured developed breathing difficulties during a fire at the prison’s sewing workshop.
Some journalists on social media accused the authorities of “setting the prison ablaze intentionally” as a high profile political prisoner was sent home before it broke out. Mehdi Hashemi Rafsanjani – son of Iran’s late former president Akbar Hashemi Rafsanjani – was given “early temporary release”, according to his brother.
Dramatic footage of the fire and smoke was first posted on social media on Saturday evening.
In several videos people could be heard outside the prison chanting “death to the dictator” – one of the main slogans of the anti-government protest movement.
Gunshots and explosions were audible in other videos – prompting rights groups to raise grave fears for the fate of the inmates.
The Fars news agency – which is linked to Iran’s Revolutionary Guards – initially said the explosions were due to mines going off after a prison break.
“Some prisoner who attempted to escape amid the fire, ended up in a minefield in the northern side of the prison,” it reported.
Later however, the agency said this was not the case, quoting a source saying no prisoner had stepped on a mine.
One video posted online appeared to show objects fired into the prison from outside its perimeter, followed by the sound of an explosion.
Families and lawyers of prisoners had not been allowed near the jail last night, and roads were blocked, the family of a political prisoner told BBC Persian.
The families of some prisoners said they had not been able to contact their relatives on the phone, and that the internet connection around the prison appeared to have been cut off.
However, later some prisoners were able to reach out to their families to tell them that they were safe.
The husband of journalist Niloufar Hamed said she had been able to phone him, and he told her he was fine, but did not know what had happened in the jail. And Iranian-American dual national Siamak Namazi told his lawyer he had been moved to a secure area.
On Saturday night Iranian state TV broadcast a report showing parts of the prison safe and calm. However exiled Iranian journalist Masoud Kazemi – who spent almost a year inside Evin – said the report had only shown areas of the jail where the action had not taken place.
British-Iranian dual nationals Nazanin Zaghari-Ratcliffe and Anoosheh Ashoori were both held at Evin prison for several years on spying charges, which they denied, before their release earlier this year.
The prison has long been criticised by Western rights groups. Human Rights Watch has accused authorities at the prison of using threats of torture and of indefinite imprisonment, as well as lengthy interrogations and denial of medical care for detainees.
A group of hackers calling themselves Edalat-e Ali (Ali’s Justice) posted videos in August last year of leaked surveillance footage from Evin prison showing guards beating or mistreating inmates.
Some foreign governments whose citizens are being held in the prison have expressed concern.
A spokesperson for the US state department said it was following events with “urgency”, while the UK Government’s security minister called it a “very worrying development”.
Since the death of Ms Amini five weeks ago, a wave of protests has swept across Iran in the boldest challenge to the Islamic Republic since its establishment in 1979.