A routine search of a prison in Brazil's Amazon region has found a flourishing criminal enterprise behind bars in the form of a cocaine-refining lab hidden behind false walls, officials said on Friday.

Guards discovered the illegal apparatus and a kilo of cocaine paste, along with 27 cellphones and 20 containers of chemicals like acetone and ether in the facility in Caceres, a spokesman for the prisons inspection said.

He confirmed information given by a local police commander, Lieutenant Colonel Jadir Metelo, who told the newspaper O Globo:"They were preparing the drug to sell it inside the prison."

The facility's warden has been absolved of participation or knowledge of the lab, but an administrative investigation has been opened.

- AFP