Afghan police have regained "full control" of Kabul's jail after four days of bloody rioting, officials say.
The stand-off lasted for several days
"The agitation is over," Deputy Justice Minister Mohammad Qasim Hashimzai told reporters outside the notorious Pul-e-Charkhi prison.
The riot began on Saturday with inmates taking over parts of the prison. At least five deaths have been reported.
Thousands of Afghans disappeared or were tortured in the jail during Afghanistan's communist era.
At least 300 of the rioters are accused of being Taleban and al-Qaeda militants, whom officials have accused of starting the unrest.
Mr Hashimzai said one body was found as some 1,300 prisoners involved in the rioting were moved under police escort to a new prison block.
Four inmates died earlier this week and a number of injured prisoners have been taken to hospital.
Trouble started on Saturday evening, apparently sparked by a change in prison uniform rules.
Prison authorities ordered inmates to wear bright orange uniforms to prevent a repeat of a January escape by seven Taleban suspects who mingled with visitors.
Armed with makeshift weapons, rioters attacked guards, setting alight furniture and bedding and smashing windows and doors.
The government sent negotiators to try to end the stand-off peacefully, but said it was ready to use force if necessary.
Troops - backed by tanks and armoured personnel carriers - surrounded the jail after the riot broke out.
There was a fresh outbreak of violence on Tuesday, when police opened fire on inmates trying to push down a gate.
Tuesday's unrest followed an apparent breakthrough on Monday - when officials agreed to distribute food and water to the protesters, and restore power.
Pul-e-Charkhi is a huge prison complex built in the 1970s on the outskirts of the capital.
The vast and run-down jail is notorious for disappearances and torture during the communist era, correspondents say.
It now houses Taleban and al-Qaeda suspects as well as common criminals. Gang leader Timur Shah, who kidnapped an Italian aid worker last year, is on death row in the jail for murder.
US ex-special forces soldiers Jonathan Idema and Brent Bennet, and US citizen Edward Caraballo, are all serving jail terms for torturing Afghans.