Growing public anger over the deaths of at least three people in custody have prompted Iran to jail the head of the Kahrizak detention centre.
"The head of the centre has been sacked and jailed. Three policemen who beat detainees have been jailed as well," Ahmadi-Moghaddam was quoted by the official IRNA news agency as saying.
'Negligence and carelessness'
The agency also reported Ghorban Ali Dorri Najafabadi, Iran's prosecutor general, as saying: "Unfortunately, negligence and carelessness by some officials caused the Kahrizak incident, which is not defendable."
"During early days, it is possible there were mistakes and mistreatment due to overcrowding in the prison."
Iran's opposition charges that young people rounded up and taken to the prison after protesting the re-election of Mahmoud Ahmadinejad, the president, in disputed polls in June, were tortured to death.
The poll, which the opposition says Ahmadinejad won through fraud, triggered a wave of protests.
At least 26 people died in the unrest, described as Iran's biggest crisis since the 1979 Islamic revolution, and hundreds of opposition supporters were detained.
The son of a top adviser to Mohsen Rezaie, the conservative defeated presidential candidate, died at Kahrizak in July.
After Mohsen Rouhalamini's death, Kahrizak, which was built for jailing violators of Iran's vice laws, was ordered closed by Ayatollah Ali Khamenei, Iran's supreme leader, due to "lack of necessary standards".
Mehdi Karroubi, another defeated presidential candidate, said that some of those detained had been raped while in prison, according a letter posted on his website.
"Some senior officials told me that ... some young male detainees were raped ... also some young female detainees were raped in a way that have caused serious injuries," the letter said.
While the recent criticism of security officials over the treatment of prisoners has been unusally pointed, a more hard-line tone came from a senior commander of Iran's powerful Revolutionary Guard.
Yadollah Javani called for Karoubi and Mir Hossein Mousavi, the main challenger to Ahmadinejad defeated in the polls, as well as Mohammad Khatami, a former president, to be put on trial.
"The question is who were the main planners and agents of this coup. What is the role of Khatami, Mousavi and Karroubi in this coup"
Yadollah Javani, Revolutionary Guard commander
The three have led the opposition to Ahmadeinjad's re-election.
"The question is who were the main planners and agents of this coup. What is the role of Khatami, Mousavi and Karroubi in this coup?" he wrote in an article in Sobh-e Sadegh, the Guards's weekly journal.
"If they are the main agents, which is the case, judiciary and security officials should go after them, arrest them, try them and punish them."
Amid the public row between officials and institutions, Iran is continuing with a mass trial of more than 100 prominent reformist figures, opposition activists and others accused of offenses ranging from rioting to spying and seeking to topple Iran's rulers in the post-election protests.
The trial has included televised confessions that rights groups say were likely extracted through pressure.
Susan Rice, the US ambassador to the United Nations, condemned the trials.
"These are show trials and they are clearly a demonstration of the fact that the Iranian leadership is not reconciled to the concerns of its people regarding the validity of the elections," Rice said on American news network CNN.