Four men have been arrested after an explosive device was made at Cardiff prison.
South Wales Police said a bottle containing an unknown liquid "erupted and slid across the floor" on 15 June.
Three of the men are under investigation while one will face no further action. The incident only came to light when a prison worker contacted South West Wales AM Bethan Jenkins.
Ms Jenkins wrote to UK Prisons Minister Sam Gyimah who confirmed it.
Mr Gyimah told Ms Jenkins it was not believed to be related to terrorism and the director of public sector prisons in south Wales was satisfied measures were in place to prevent it happening again.
In Ms Jenkins' letter to the minister she wrote: "I was informed by the staff member in question that prisoners recently made a bomb out of tea whiteners, which are very flammable.
"I understand that the bomb was stopped from going off in this instance, but that staff rely on prisoners behaving so that no serious incidents take place.
"I was told that if they rose up, they would be able to take over in less than 10 minutes, and that this was close to actually happening recently.
"The staff member implied that they were very short staffed also and so they are worried that they would not be able to react sufficiently in an emergency situation."
Ms Jenkins queried staffing levels at the site and asked if more support would be given to Cardiff prison as a result.
In his response, Mr Gyimah said HMP Cardiff had 165 prison officers and 35 operational staff - 18 employees short of its target staffing level.
South Wales Police said it had been a "minor incident".
The Ministry of Justice confirmed an incident had taken place and no prisoners or staff had been hurt.
A spokesman added: "The matter was referred to the police and it would be inappropriate to comment further at this stage."