0118 GMT October 23, 2019
Five inmates and the three guards were initially killed by prisoners in the riot that erupted on Sunday evening, and the others died in clashes with security forces trying to restore order, the Justice Ministry said in a statement, AFP reported.
The prison in Vakhdat, 17 kilometers (11 miles) east of the capital Dushanbe, holds 1,500 inmates.
The ministry said the rioters first stabbed to death three guards, and then five other inmates "in order to intimidate" the others.
They then took other prisoners hostage before opening fire in the jail's medical facilities.
"Following a reprisal operation, 24 members of this group were killed and 35 others arrested. The hostages were freed" and calm restored, the statement said.
Authorities said the prison was now functioning normally, with the "situation currently under control."
Second riot in six months
The prison is a short drive from Dushanbe, with residential neighborhoods nearby. It houses inmates convicted of various crimes, including terror and extremism charges, and is secured by armed guards.
Families of inmates gathered near the prison on Monday to find out if their relatives were safe.
In November 2018, another riot claimed by Daesh left 26 people dead in Khujand, a city in the northeast of the country. That riot was initiated by a former Daesh member seeking to spark a mass escape.
Last week a Tajik court sentenced nine of the prison staff, including the head of the prison, to jail terms up to four years of prison for "negligence."
The extremist rioters are awaiting sentencing and face new prison terms ranging from 10 to 20 years.
Tajikistan, a poor mountainous country of nine million people bordering Afghanistan, has suffered from severe conflict since it gained independence after the collapse of the Soviet Union in 1991.
Tens of thousands of people were killed in Tajikistan during a five-year civil war in the 1990s when rebel groups including extremists rose up against the government.
Authorities in the majority-Muslim country have said that more than 1,000 Tajiks, including a high-ranking police officer who defected in 2015, joined Daesh in Syria and Iraq in recent years.
In July 2018, an attack on foreign cycling tourists left four dead and two injured. The assault was widely attributed to Daesh, although the government has refused to acknowledge the link.