Dozens of inmates rioted at a psychiatric block in a prison in northern Mexico broke into a prison pharmacy.
Two overdosed and died on medications stored there.
Thirteen more were injured in Tuesday's riot, including one guard.
The riot occurred in the Cadereyta penitentiary, near the city of Monterrey.
A state security spokesman said about 56 inmates at a psychiatric block burned about 200 cells and furnishings.
The complex chain of events at the prison in Cadereyta, in Nuevo Leon state, started earlier this week when inmates protested a new program to inspect visitors with a type of X-ray machine to prevent contraband being smuggled into the facility.
The X-ray issue caused a smaller disturbance Monday, in which two guards and five prisoners were hurt after inmates blocked corridors in the facility with burning mattresses.
AP and Reuters contributed to this report.