Forty Opotiki College students narrowly escaped a fire which badly damaged the school buildings they were about to sleep in, the Fire Service says.
Bay of Plenty's Fire Risk Management Officer Jon Rewi said the students were set up to sleep in the wharenui and an adjacent room on Saturday night.
They were out of the buildings when the blaze started, sparked by mattresses placed over the under-floor heating vents, Mr Rewi said.
The students would have been trapped had they been inside as the emergency exits were blocked by tables, chairs and mattresses.
Mr Rewi said there was no working fire alarm, and a caretaker was alerted after the burglar alarm went off.