KABUL — The deadliest bombing to strike Kabul in months detonated Saturday outside a school for girls, killing at least 50 people and wounding more than 100, a week after the United States and NATO began the complete withdrawal of their forces from the country.

At the sound of the blast, the school’s principal, Aqila Tawakoli, rushed out to the front gates. It was the end of the school day, and she knew many of her students would still be in the street outside.

“It was like a doomsday that I saw with my own eyes,” she told The Washington Post by phone soon after the blast. “Schoolgirls were fleeing back into school, crying and screaming.”

Violence has risen across Afghanistan since the start of the withdrawal of U.S. and NATO forces on May 1. Much of the increased violence has been from Taliban attacks on vulnerable government-held towns and cities, but on the eve of the withdrawal, a similarly large bombing struck Logar province just south of Kabul.

No group has claimed responsibility for either attack, but they raise concerns that the instability created by the withdrawal of foreign forces could also bring with it waves of violence in urban areas where civilians make up most of the casualties.

The Taliban denied involvement in the attack. Zabiullah Mujahid, a spokesman for the group, condemned it in a tweet. The bombing “targeted civilians & sadly caused heavy losses,” he wrote.

Afghan President Ashraf Ghani also condemned the bombing in a tweet, but he blamed the Taliban for the bloodshed, saying the group is “reluctant to resolve the current crisis peacefully and fundamentally.”

Many of the dead and wounded from Saturday’s attack appeared to be students. Images of the scene that aired on local media showed young women in school uniforms lying in the normally busy street, surrounded by backpacks and notebooks mixed with debris.

“Parents were rushing to school, searching for their children, asking me where to find them,” Tawakoli, the school principal, said, her voice catching. “I had no idea what to do.”

Soon after the attack, ambulances rushed in and out of the neighborhood, sirens blaring.

The truck bombing in Logar province last week killed at least 21 people and wounded at least 91. It also struck near an educational institution: The explosives detonated outside a dormitory for students preparing for university exams.

Saturday’s bombing outside Kabul’s Syed Al-Shahda school was in the city’s western neighborhood of Dasht-e-Barchi. Girls from primary through high school attend Syed Al-Shahda, but when the attack struck, classes were being held only for seventh- through 12th-graders.

The Islamic State has carried out several attacks in western Kabul. The neighborhood is predominantly home to ethnic Hazara and Shiite Afghans, whom the Islamic State views as heretics.

Last year, gunmen carried out a brutal attack on a maternity ward in the same neighborhood, killing 16 people, including two newborns. The Afghan government also blamed that attack on the Taliban. But it went unclaimed, and the United States said Islamic State fighters carried it out.