The blaze happened in the early hours of Wednesday when most of the prisoners were asleep.