A fire killed 24 people, mostly teenagers, trapped behind barred windows and a blocked exit in an Islamic school dormitory on the outskirts of Malaysia’s capital early Thursday, officials said.

Firefighters rushed to the scene after receiving a distress call at 5.41 a.m. and took an hour to put out the blaze, which started on the top floor of the three-story building, Kuala Lumpur police chief Amar Singh said. He said there were at least 24 charred bodies, 22 of them boys between 13 and 17, and two teachers.

Singh said 14 other students and four teachers were rescued, with six of them hospitalized in critical condition.

"We believe (they died of) suffocation...the bodies were totally burnt," he said.

The fire broke out near the door of the boys’ dormitory, trapping the victims as it was the only entrance and the windows are grilled, fire department senior official Abu Obaidat Mohamad Saithalimat said.

He said the cause was believed to be an electrical short-circuit.