She dove underneath the bench where she was sitting and then felt an explosion rock the building, she said. When she opened her eyes, she tried to understand the chaos around her: The roof had caved in. Some fellow students had lost arms and legs, she said. Others were crying and shouting. Limp bodies were scattered around the classroom.

“I was so scared, I was thinking, ‘How am I alive?’” she said.

In a new protocol instituted by the Taliban government, the classroom had been divided into separate sections for girls and boys. The blast targeted the girls’ section, according to Mr. Hisari and Ghulam Hazrat Ghaznawi, who was administering the exam at the center on Friday morning.

In interviews with The New York Times, staff members at five hospitals in Kabul reported a total of 31 killed and around 70 wounded in the attack. Most of the dead and wounded were girls, the medical staff said.

The attack came as girls’ education has become a contentious issue for the new government. In March, Taliban officials abruptly reversed their decision to allow girls’ high schools to reopen drawing widespread condemnation from Western diplomats and human rights groups.

In the months since, some Taliban officials have publicly called for girls to return to high schools — bringing attention to a rift the leadership has sought to play down, between ideologues and pragmatics among the Taliban.

For some girls, the move to close schools and the recent string of attacks on education centers have emboldened them to continue their studies however they can — whether applying for visas to study abroad, forming informal study groups among their peers, or taking courses at education centers like Kaaj.

Arezu Hassani, 14, was about to begin ninth grade when the Taliban took over last year and girls’ schools were closed indefinitely. Desperate for any way to continue learning, she began taking mathematics and physics courses at a branch of the Kaaj education center.