Some 3,000 Guatemalan troops and police have stormed the country's Pavon jail, which had been controlled by prisoners for 10 years.
They met fierce resistance from prisoners using firearms and grenades. The bodies of seven dead inmates were removed afterwards.
Police removed all 1,600 inmates from the prison, where prisoners had set up their own shops, churches and cocaine laboratories.
Prisoners were allowed a say in running the jail in 1996, but quickly took over. The government said it was a centre of "organised crime, drug trafficking, kidnapping and extortion".
Guatemalan President Oscar Berger surveyed the scene afterwards. He said the jail had been "degrading, inhuman and a mess" and "totally without authority".
Inmates' relatives gathered outside as events unfolded. Many central American jails are hives of gang violence and drug-funded corruption.