DHAKA, Bangladesh (AP) 鈥 A Bangladesh air force training aircraft crashed into a school in the nation's capital Monday afternoon, killing the pilot and 26 other people, most of whom were students, officials said.

The crash caused a fire that left the two-story building in Dhaka smoldering. Officials said 171 people, mostly students and many with burns, were rescued and taken from the scene in helicopters, ambulances, motorized rickshaws and in the arms of firefighters and parents.

Twenty deaths were reported initially, and seven died of their injuries overnight, authorities said Tuesday morning. Doctors said late Monday that the condition of about two dozen injured remained critical.

Twenty bodies have been handed over to their families. Some of the charred bodies were beyond recognition and they might need DNA tests for matching. A blood donation camp has been opened at a specialized burn hospital where most of the injured were being treated.

The Chinese-made F-7 BGI training aircraft experienced a 鈥渢echnical malfunction鈥 moments after takeoff at 1:06 p.m., and the pilot attempted to divert the plane to a less populated area before crashing into the campus of Milestone School and College, according to a statement from the military.

But it remained unclear how the pilot died: whether he was inside the jet or ejected himself before it hit the building. The military did not provide any details on that.

Many relatives waited overnight at a specialized burn hospital for bodies of their loved ones.

Around midnight, Mohammed Abdur Rahim was looking for his cousin Afia Akter in a hospital. 鈥淲e could not find my cousin. She is missing. Doctors here have asked us to go to other hospitals,鈥 he told The Associated Press.

Students said the school鈥檚 buildings trembled violently, followed by a big explosion that sent them running for safety. A desperate scene soon unfolded at the crash site, as panicked relatives searched for loved ones. Screams filled the air at a nearby hospital.

The Milestone school is in Dhaka鈥檚 Uttara neighborhood, about an 11-kilometer (7-mile) drive from the A.K. Khandaker air force base. The school is in a densely populated area near a metro station and numerous shops and homes.

The pilot, Flight Lt. Mohammed Toukir Islam, made 鈥渆very effort to divert the aircraft away from densely populated areas toward a more sparsely inhabited location,鈥 the military said, adding that it would investigate the cause of the crash.

Local media said it was the pilot鈥檚 solo flight as he was completing his training course.

It is the deadliest plane crash in the Bangladeshi capital in recent memory. In 2008, another F-7 training jet crashed outside Dhaka, killing its pilot, who had ejected after he discovered a technical problem.

The government announced a day of mourning Tuesday, with flags to fly at half-staff across the country.

Mosammat Sagorika, who scored four goals Monday to defeat Nepal in an under 20 women鈥檚 South Asian soccer championship match, dedicated the country鈥檚 win to the crash victims.

鈥淢any people have died, and many are injured. So, we all are sad," the 17-year-old Sagorika told reporters.

At the crash site Monday afternoon, a father sprinted with his daughter cradled in his arms. A mother cried out, having found her younger child, but desperately searched for her older one.

Another father described his feeling of helplessness while waiting to learn the fate of his daughter.

鈥淭he plane crashed on the building where my daughter was. My wife called me, but I was praying so I could not pick up," Jewel, who goes by one name, said at the scene. 鈥淲hen I came here I saw there was a huge fire. There was a dead body of a child.鈥

Luckily, his daughter was safe, he said, but he saw many other children suffering from burns.

Students also scrambled to see what had happened. 鈥淲e fought with the crowd and the soldiers to get close to the crash site in our school,鈥 said Estiak Elahi Khan, who is in the 11th grade. "What I saw I can't describe that ... that's terrible."

Doctors at Uttara Adhunik Hospital said more than 60 students, many between the ages of 12 and 16, were transferred to a special hospital for burn victims.

By Monday evening, rescuers continued to scour the debris, searching for bodies. A crane was being used to remove debris.

Bangladesh鈥檚 interim leader, , also pledged an investigation, and he expressed his deep sorrow over the 鈥渉eartbreaking accident.鈥 He called it 鈥渁 moment of deep national grief.鈥

Indian Prime Minister Narendra Modi also expressed shock and sadness. 鈥淥ur hearts go out to the bereaved families,鈥 Modi said in a post on X. 鈥淚ndia stands in solidarity with Bangladesh and is ready to extend all possible support and assistance.鈥

Rafiqa Taha, a student who was not present at the time of the crash, said by phone that the school, with some 2,000 students, offers classes from elementary grades through high school.

鈥淚 was terrified watching videos on TV,鈥 the 16-year-old said. 鈥淢y God! It鈥檚 my school.鈥

___

Associated Press journalists Al-emrun Garjon and Rafiqul Islam Mithu contributed to the report.

The 好色tv Press. All rights reserved.