Senegal's President Macky Sall says the government will close down Koranic schools that fail to meet basic safety standards.
His comments came after nine children were killed by a fire at a school near the centre of Senegal's capital, Dakar.
The blaze broke out as 45 children aged from six to 12 slept inside a single room with wooden walls and zinc roofing in the Medina district, witnesses said.
A candle is thought to have caused the fire, which began late on Sunday.
After visiting the scene, Mr Sall, a Muslim, said Koranic schools that exploited children and failed to ensure they were safe would be shut.
The children would be sent back to their families, he said.
The BBC's Thomas Fessy in Dakar says human rights groups have repeatedly warned of the poor conditions in which children are housed in Koranic schools, and some teachers have been accused of abuses.
Most of the pupils - known as "talibes" in the local language, Wolof - end up begging on the streets for money and food which they have to take back to their teachers, our correspondent adds.
Fire engines were reported to have struggled to drive down the narrow road leading to the school, hampering efforts to extinguish the blaze.
Dakar's mayor, Khalifa Sall, told local RFM radio that the ramshackle development of densely populated residential areas in the city made it impossible for the emergency services to operate effectively.