Rescuers are racing to pull dozens of students and workers from under the rubble of a school building that collapsed in East Java, Indonesia.

Three people have been killed and 99 others hospitalised, some of them with critical injuries, officials said Tuesday, adding that the death toll may rise.

At least 38 others, many of them teenage boys, remain trapped under the Al Khoziny Islamic Boarding School in Sidoarjo. They had gathered for prayers when the building gave way on Monday.

The two-storey building had an unstable foundation and could not support the weight of the construction of two additional floors, the disaster mitigation agency stated.

The girls had managed to escape from a different part of the building during the collapse.

Footage from local media shows the collapsed portion of the building heavily sunk in, with large slabs of concrete exposed. Shouts for help from the trapped individuals have filled the air as anxious relatives await news of their loved ones.

Emergency crews have been searching for survivors but had to temporarily halt operations on Tuesday due to fears of further collapse. The building took on a “pancake type structure” making rescues increasingly challenging, according to search and rescue agency head Mohammad Syafeii, who has also prepared for a specialized operation.

Students who survived the incident shared their stories of escape. Seventh grader Muhammad Rijalul Qoib recounted how he heard a loud crashing noise that signaled the beginning of the disaster. He described running for safety as debris fell around him.

The school’s caretaker apologized to families, attributing the incident to God's will. However, local officials noted that the school management did not secure the necessary permits for its construction.

Indonesia's construction safety record is poor, raising major concerns following this and previous collapses, emphasizing the need for regulation and oversight in the sector.