Mattresses were set ablaze, a pharmacy robbed and prisoners poisoned during two days of riots at a Mexican prison in Cadereyta that left two dead and at least 13 wounded.

The demonstrations in the northern state of Nuevo Leon began on Monday due to the use of new X-ray equipment at the entrance to the prison. Guards detained two women who tried to enter the jail with drugs hidden on them, according to state security spokesman Aldo Fasci Zuazua.

READ MORE: Over 250 skulls found in Veracruz mass graves

After the riot, Fasci said that pregnant women would not have to go through the X-ray machines.

About 40 inmates began protesting by blocking the corridors with blazing mattresses to prevent the passage of guards, Fasci said.

Prisoners also said they were being deprived of food and water.

It was the second fatal security breach in a week for Mexico's troubled prison system.

On Friday, three inmates died in a prison riot in the neighbouring state of Tamaulipas after a jailbreak.

In February 2016, 49 people were killed in a massive gang fight in the Topo Chico prison in Monterrey.

The state of Nuevo Leon and its surrounding territories have long been battlegrounds in Mexico's drug wars. The prisons nearby house many members of rival drug cartels that fight for control of local drug markets and smuggling routes to the United States.