Trainee sniffer dogs visiting a special needs school uncovered a £1.3million dope factory next door.
They were taking part in a workshop outing for children when they detected the huge haul.
Dog handlers raised the alarm after the animals kept going over to sniff the wall of the industrial unit.
Police raided the premises and discovered hundreds of cannabis plants being grown.
Officers found three men hiding in a cupboard next to the giant crop in Leicester.
Renald Dema, 21, Ali Hoxha, 29, and Juljan Jaku, 24, all of no fixed address, admitted cultivating cannabis.
The three men were jailed at Leicester crown court on Wednesday.
Dema was locked up for two years and three months, Hoxha for two years and nine months and Jaku for two-and-a-half years. The court was told children were taking part in a sensory learning session during the find last November.
A private security firm that trains dogs in drug searches and private protection carried out the workshop.
Det Insp Ross Dimmock, from Leicestershire Police, said: “This was a significant discovery. It not only led to three people being arrested but also stopped more than a £1million worth of drugs hitting our streets.
“Those responsible for this cannabis factory thought their actions would go unnoticed but they were wrong.
“We would like to thank the person reporting the discovery for their assistance.
“Drugs are a blight on society and lead to criminality and the breakdown of relationships and families. We take these offences extremely seriously.”