ESCUINTLA, Guatemala — Hundreds of anti-riot police entered a maximum-security prison in Guatemala early Sunday to free guards taken hostage and retake control of the facility that houses gang leaders, and ensuing attacks on police in the capital left at least three officers dead.

Shots sounded as police swept into the Renovación prison in Escuintla, about 47 miles southwest of Guatemala City. About 15 minutes later, an Associated Press journalist saw guards being escorted from the prison. They appeared to be unharmed. No injuries or deaths were immediately reported.

But shortly after authorities retook control of the prison, reports began to emerge of attacks on police in the capital.

National Civil Police Director David Custodio Boteo said there were at least 10 armed attacks against police, leaving three officers dead and at least five wounded. Five attackers were captured, he said.

Interior Minister Marco Antonio Villeda said Saturday night that nine guards were taken hostage in the prison. Some three dozen other guards were being held at two other prisons, where inmates took control in a coordinated uprising Saturday.

The Interior Ministry said in a statement that the inmate uprising was in response to prison administrators’ decision to strip privileges from some imprisoned gang leaders.

“In Guatemala, we don’t negotiate with terrorists nor with organized crime,” the statement said. “We also don’t allow groups that have sown fear to impose their conditions.”

In October, President Bernardo Arévalo accepted the resignations of three top security officials, including Villeda’s predecessor, after authorities acknowledged that 20 gang members escaped over a period of days.

“The link between the prison system and the criminality outside has to be cut,” Arévalo said in an interview with the Associated Press on Thursday. “That’s why all this effort to regain control of the prison system is very important.”

Castillo writes for the Associated Press.