A fire that blocked the only exit to an Islamic school dormitory has killed 23 people, mostly teenagers, on the outskirts of Malaysia's largest city, officials said.
A government official said a wall separating the victims from a second exit "shouldn't have been there".
Firefighters and witnesses described scenes of horror - first of boys screaming for help behind barred windows as neighbours watched helplessly, and later of burned bodies huddled in corners of the room.
Islamic teacher Arif Mawardy said he woke up to what he thought was a thunderstorm, only to realise it was the sound of people screaming.
Firefighters rushed to the scene in Kuala Lumpur after receiving a distress call at 5.41am and took an hour to put out the blaze, which started on the top floor of the three-storey building, Kuala Lumpur police chief Amar Singh said.
Mr Singh said 23 charred bodies were recovered - 21 boys between the ages of 13 and 17 and two teachers.
"We believe (they died of) suffocation... the bodies were totally burnt," he said.
Mr Singh said 14 other students and four teachers were rescued.
Health Minister S Subramaniam said six other students and a resident who went to help were taken to hospital, with four of them in critical condition.
He said the 23 bodies were in the Forensics Department waiting to be identified through DNA.
The fire broke out near the only door to the boys' dormitory, trapping the victims because the windows were barred, fire department senior official Abu Obaidat Mohamad Saithalimat said.
He said the cause was believed to be an electrical short-circuit, although Mr Singh said the investigation was continuing.
Another fire department official, Soiman Jahid, said firefighters heard shouts for help when they arrived at the school.
He said they found a pile of bodies in the right corner of the dorm and another pile in the left corner.
Local media showed pictures of blackened bed frames in the burned dormitory.
A resident, Nurhayati Abdul Halim, was quoted as saying that she saw the boys crying and screaming for help.
"I saw their little hands out of the grilled windows; crying for help.
"I heard their screams and cries but I could not do anything.
"The fire was too strong for me to do anything," she said.
She added that the school had been operating in the area for the past year.
Noh Omar, Malaysia's minister for urban well-being, housing and local government, said the school's original architectural plan included an open top floor that allowed access to two exit staircases.
However, he said a wall had been built dividing that floor, leaving only one exit for the dorm.
"The wall shouldn't have been there," he said.
He added that the school submitted an application for a fire safety permit that had not been approved.
The school, Darul Quran Ittifaqiyah, is a private Islamic centre, known as a "tahfiz" school, for Muslim children, mainly boys, to study and memorise the Koran.
School principal Mohamad Zahid Mahmod was quoted by the Berita Harian newspaper as saying the students were being housed in a temporary building because of renovation work at the main school building.
He said they were due to move back at the end of this month.
Mohamad Zahid said the school has been operating for 15 years and is registered with the state Islamic religious council.
He said the school had housed 42 students, six teachers and two wardens.
However, an official with the state religious council said it had no record of the school.
The Star newspaper said there were 519 tahfiz schools registered nationwide as of April, but many more are believed to be unregistered.
Many such schools are exempt from state inspections.
The newspaper said the fire department has recorded 211 fires in such private Islamic centres since 2015.
In August, 16 people fled a fire at a tahfiz school in northern Kedah state.
Another tahfiz school was destroyed by a fire in May but no one was hurt.
The worst fire occurred in 1989 when 27 female students at a private Islamic school in Kedah state died in a blaze that gutted the school and eight wooden hostels.