It was a small fire in a garbage can that fire officials say could have turned into a disaster.
It happened Thursday at Yeshiva Avir Yakov in New Square.
Most of the students were able to get out of the dormitory on their own.
But, as the building filled with smoke, 20 teenage students went toward a portion of the building that had no way out.
Before firefighters cut through the door, someone arrived with a key and let the students out.
Members of the community claim doors to the dormitory were unlocked, and that only the side of the building that houses the school was locked because it's closed for Passover.
A member of New Square's community patrol group insists no one was trapped.
"When the fire alarm went on no one was in the building," said Aron Kaff, the community leader.
But, firefighters say they have pictures that show clear violations of fire codes.
The photos show doors that were either padlocked, or dead-bolted, or stairwells blocked by an iron gate.
There is a long history of tension between the Hassidic community and fire officials over dangerous violations.
"Something like this is undoubtedly barbaric, it's incorrect, they're not doing what they need to be doing to ensure the safety of their children and the people that they are serving," said Chief Weppler.