Authorities have regained control of Afghanistan's most notorious prison after four days of rioting allegedly sparked by Al Qaeda and Taliban convicts, a senior official said Wednesday. One more body was found inside the prison, raising the number of inmates reported killed in the revolt to six.

Deputy justice minister Mohammed Qasim Hashimzai said more than 1,300 unruly inmates at Policharki prison, including the 350 Taliban and Al Qaeda loyalists, were transferred to another block of the prison under official guard. As they cleared out, one more prisoner was found dead, he said.

At least 40 prisoners were reported injured in the revolt, officials said.

"God help us, now everything is safe and secure," Hashimzai told reporters.

Hashimzai said American inmate Edward Caraballo, who had earlier called media to say other prisoners had threatened to cut his head off, was safe.

Afghan soldiers escorted reporters to look inside the prison on the outskirts of the Afghan capital.

Block Two, where the rioting by hundreds of inmates broke out late Saturday, was dark and empty, but flashlights showed its walls scarred with bullet holes inside and out. There was a burnt smell from where prisoners had set fire to bedding and furniture.

Women inmates could be seen looking out of small cell windows from a separate, nearby block. There are about 70 women inmates and another 70 children living with them in the prison. Gen. Mahboob Ullah Amiri, commander of a rapid reaction force at the prison, said none of the women prisoners had been hurt, although their section of the jail had been infiltrated by rioters.

He said the riot had been led by a former senior Taliban commander, Mullah Mujahed. About 100 Taliban and Al Qaeda inmates considered dangerous were now in separate rooms from other prisoners and under tight security, he added.

Hundreds of inmates began rioting late Saturday, reportedly after refusing new prison uniforms that were being introduced after some Taliban inmates escaped last month by disguising themselves as visitors.

Security forces had surrounded the prison to prevent escapes as government officials tried to negotiate with the rebellious inmates.

There was a fresh outbreak of violence on Tuesday, when police opened fire on inmates trying to push down a gate, killing one and injuring three.

But early Wednesday, authorities reported progress in resolving the standoff, saying hundreds of prisoners were in the process of being transferred from Block Two, where the rioting began. Hashimzai said the transfers were complete by early evening.

On Tuesday, about 1,000 prisoners had made clear they wanted to surrender, leaving only a hard core of Al Qaeda and Taliban who wanted to stick it out. But they too had eventually relented and were now under tight security, Hashimzai said.

It was not clear whether the government had made any concessions to the inmates, who had been complaining of poor prison conditions and unfair convictions.

Earlier Wednesday, Caraballo, one of three Americans detained at the prison, said that rioting inmates were holding him in his cell and had threatened Tuesday to cut off his head. But they later backed away from the threat, he said.

"Hopefully the situation will quiet down so I can walk out of here ... I just want to get out of here," he said.

Caraballo had said he was staying with hundreds of other prisoners and they were moving around freely inside, armed with "sticks, pipes, chains, knives."

Officials, however, said the situation in Block One, where Caraballo was detained, was calm and that it had not been necessary to transfer prisoners from that part of the prison.

Caraballo, from New York, is serving a two-year sentence after he was arrested in July 2004 along with Jonathan Idema and Brent Bennett. They were accused of running a private jail in Kabul as part of a freelance hunt for terrorists.

Caraballo claims he is a journalist and had believed he was chronicling a legitimate counterterror operation.

Hashimzai criticized Caraballo for speaking to media and said authorities had confiscated his mobile phone and laptop computer — and those held by other prisoners in Policharki.

Policharki Prison was built in the 1970s and is notorious for harsh and crowded conditions.

Some of the prison blocks are being renovated ahead of the expected arrival of some 110 Afghan terror suspects later this year from the U.S. military prison at Guantanamo Bay, Cuba, but there has been little work on the rest of the facility.