The fire at Darul Quran Ittifaqiyah was reported about 5.40am Thursday local time (9.40am NZT), according to a statement from the Malaysian Fire and Rescue Department.
Fire officials said numerous bodies found in the school's dormitory had been burned beyond recognition, but they confirmed that the remains belonged to 22 boys, ages 13 to 17, and two teachers.
He said that it's too early to say how the fire started but added "the Fire and Rescue Department and police will investigate it thoroughly".
Mahathir had visited victims of the tragedy at the Hospital Kuala Lumpur (HKL) and also spent about 45 minutes with the victims' families at the hospital's Medical Forensics Institute. Two teachers also died.
Police initially believed the fire was an accident caused by an electrical short circuit or a mosquito-repelling device but said Friday they were not ruling out foul play.
Kuala Lumpur Police Chief Amar Singh further said that police had found at least 24 charred bodies, 22 of them boys between 13 and 17, and two wardens.
"The youngsters were sobbing for help, yet I couldn't help them as the entryway was at that point ablaze", he said. But he said a wall had been built dividing that floor, leaving only one exit for the dorm.
They are already facing scrutiny in the wake of the death of an 11-year-old boy who had allegedly been beaten at one of the institutions last year.
Azeman Abdullah, a local resident from Malacca state, who sent three of his boys to attend a part-time private religious school, said lacking a unified regulation system, in terms of syllabus and fire safety measures, may be a major drawback of such schools. Unfortunately, the fire was huge and we had to run to the ground floor instead.
Deputy Prime Minister Ahmad Zahid Hamidi told reporters that it isn't the first such incident, adding that all Islamic religious schools were required to register and follow safety requirements.
After the fire broke out, nine fire engines and several operators are making efforts to douse the fire. But The Star Online, citing fire records, put the number at 211 fires in the past two years alone.