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, where 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 more floors, according to the disaster mitigation agency.

The girls were praying in another part of the building and managed to escape, according to the Associated Press. Students in the school are between the ages of 12 and 17.

Footage from local media shows the collapsed section of the building entirely sunken in, with large slabs of concrete protruding. Amidst the wreckage, the sounds of crying and shouting can be heard, as anxious relatives gather outside, awaiting news of their loved ones.

Rescue efforts, temporarily halted due to fears of additional collapses, face challenges as the building shows signs of a pancake type structure with layers of concrete slabs, making access to potential survivors hazardous.

Mohammad Syafeii, head of the search and rescue agency Basarnas, explained the dilemma of utilizing heavy equipment which, while necessary for lifting debris, poses risks to any survivors still trapped beneath.

The harrowing experiences of teenage survivors have begun to surface. Seventh grader Muhammad Rijalul Qoib recounted hearing the sound of collapsing rocks, prompting him to flee the premises even as he sustained injuries from falling debris.

Sidoarjo's regent has reported that the school's management did not secure proper construction permits, highlighting ongoing concerns regarding regulatory oversight within Indonesia's construction sector, known for its poor safety records.

As rescue operations continue, families remain hopeful for the safe return of missing students amidst the backdrop of pressing questions regarding building regulations and safety measures in the region.