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 the East Java town of 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 reported.

The girls were praying in a different part of the building and managed to escape, according to the Associated Press. Students enrolled range between the ages of 12 and 17.

Footage shows the collapsed structure completely sunken in, with large slabs of concrete jutting out. Authorities have heard cries and shouts from the rubble, while anxious relatives camp out nearby, awaiting news of their loved ones.

Dozens of rescuers worked through the night in search of survivors, although operations were temporarily halted on Tuesday due to fears of further collapse. Mohammad Syafeii, head of the search and rescue agency Basarnas, described the wreckage as having taken a pancake-like structure, complicating rescue efforts.

He indicated that specialized operations were being prepared, featuring units equipped with special tools for extricating survivors. However, he cautioned about the risks of using heavy equipment, as it could contribute to the danger for those still trapped.

Teen survivors shared their traumatic experiences. Seventh grader Muhammad Rijalul Qoib recounted how he fled when he heard the rumbling of falling rocks, barely managing to escape debris that hit him during the chaos. Another student, Sofa, described the injuries inflicted on his fellow classmates, including visible broken bones.

The school's caretaker, KH Abdus Salam Mujib, expressed his apologies to families affected by the disaster, attributing it to God's will. He stated a hope for recovery and better circumstances ahead.

Authorities are currently investigating claims that the school management had not obtained necessary permits for the building's expansion. Al Khoziny is a traditional pesantren, focusing predominantly on Islamic education but also incorporating general studies.

Indonesia's construction sector faces ongoing scrutiny for poor safety records, with this tragic incident further underscoring the urgent need for reform in the industry.