Officers arrived to find Lee Steven Clark struggling to open the window of his home as white smoke billowed from the property.
Leeds Crown Court heard Clark was in the process of producing the highly addictive drug methamphetamine.
The kitchen of the flat, on Maybush Court, Aggbrigg, Wakefield, was filled with items often used for the so-called ‘Shake and Bake’ method of producing the Class A drugs.
Materials included sulphuric acid, batteries, bottles, tubs, drain cleaner, tablets, face masks and rubber gloves.
Other people were also in the property at the time of the incident, on April 17, 2014.
Mr Nassiri said one of the men told officers that they had been trying to make ‘Bubble Hash’.
The prosecutor said it was clear that attempts were being made to produce methamphetamine.
He added: “Had he been successful, he would have produced five grammes.
“Clearly he wasn’t and it seems that everything went wrong.”
Officers searched the rest of the property and found bags of amphetamine worth £7,600.
Clark, 42, pleaded guilty to attempting to produce a class A drug and possessing a class B drug with intent to supply. He was jailed for 18 months.
The court heard Clark had previous offences for burglary, handling stolen goods and breaching court orders.
John Dunning, mitigating, said Clark had a long-standing addiction to drugs.
He said Clark had agreed to store the amphetamine on behalf of someone else.