Malaysian police said Saturday they have arrested seven people age 11 to 18 in connection with a recent fire at a religious school that killed 23 people.

The suspects are being investigated on suspicion of "mischief by fire" and murder over Thursday's fire at the school, Pusat Tahfiz Darul Quran Ittifaqiyah, in Kampung Datuk Keramat on the outskirts of the Malaysian capital, Kuala Lumpur police chief Amar Singh told reporters.

He said the group planned to set fire to the school following conflict with some of its students.

The police believe they used gasoline-based accelerants and took two gas tanks to the top floor of the three-story dormitory of the all-male boarding school. The court has allowed the police to detain them for seven days pending further investigation.

Police identified the suspects after viewing security cameras from an adjacent building.

The blaze started at the only entrance of the dormitory at the top floor. Those who died were unable to escape because of barred windows.

The dead are 21 students between ages 6 and 16 and two teachers in their 20s. The death toll from the fire has sparked outrage over inadequate safety measures at the school.

There have been 211 fires involving similar religious schools since 2015 in the country.

In the deadliest such fire, 27 female students of a religious school in northern Kedah state died in 1989 when fire tore through the school and eight wooden hostels.