The explosion took place just as the morning classes for girls were ending and boys were arriving for their lessons. The average age of the students at the primary school is 12.

During the worst years of violence in Iraq, when often teachers were killed, many schools were closed. Since security has improved and the schools have reopened in the past two years, security officials said, there have been no reported cases of attacks directed at schoolchildren.

But children have been caught in Iraq’s violence before, most recently when at least 30 were killed in a powerful bomb attack at the Justice Ministry in October. Many were at day care centers in the building.

During the war, children have been used to get through checkpoints in suicide car bombings. They have been kidnapped, caught in the cross-fire of warring factions and killed in errant missile strikes and in roadside bombings.

Photo

The school that was the site of the explosion on Monday is in an alley in an impoverished section. The bomb crater — 15 feet wide and 6 feet deep — was just outside a wall around the school.

“There was trash being burned outside, and a cable from the electricity had just fallen, so my teacher was looking out the window,” said Ritha Kadhim, 12, speaking from his hospital bed, one of his eyes closed and swollen, the other filled with blood. Then there was an explosion. “I fell down and everything was dark. One of my friends helped me up. We were all going out when I fell again, and the next thing I recall is waking up in the hospital. And now I just want to know if my friends are O.K.”

Advertisement Continue reading the main story

While it was unclear whether the explosion was an accident, officials say militants behind a recent spate of attacks on security forces want to regain a footing in their former strongholds. In particular, militants have attacked members of the Awakening movement, a predominantly Sunni Arab force recruited to fight Sunni Islamic extremists.

Newsletter Sign Up Continue reading the main story Please verify you're not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up You will receive emails containing news content , updates and promotions from The New York Times. You may opt-out at any time. You agree to receive occasional updates and special offers for The New York Times's products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters.

Early Monday, gunmen ambushed a checkpoint run by Awakening members in northern Baghdad. They killed five guards using guns equipped with silencers, according to the local police.

Militants also used poison on Monday to kill two members of the Awakening in the volatile city of Kirkuk, north of Baghdad, according to local security officials.

Col. Younis Kadhawi, a local Awakening leader, said two of his men at a checkpoint were approached by some people who offered them lunch. The guards shared the food with two dogs at the checkpoint, and the men and dogs were later found dead in the street. The colonel said poisonings were increasingly common.