A plainclothes security officer escorts students rescued from nearby school during a Taliban attack in Peshawar. Photo / AP
It was the beginning of an eight-hour massacre in which 132 of the school's 1092 students and nine of the staff were to die, with hundreds more injured. The nightmare ended only after nightfall as Pakistani Army commandos went from classroom to classroom, checking that all the militants were accounted for.
Nine died during the day, several blowing themselves up in the school and killing students as well. Seven soldiers were wounded. By the end of the day the concrete buildings were reduced to smoking rubble.
In another classroom of the boys-only Army Public School in the heart of Pakistan's most dangerous city, a 16-year-old student named Shahrukh Khan was getting down to work when, as he later recalled, "Someone screamed at us to get down and hide below the desks."
Within seconds the gunmen were among them. "They shouted 'Allahu Akbar' [God is great] before opening fire. I saw a pair of big black boots coming towards me. This guy was probably hunting for students hiding beneath the benches. 'There are so many children hiding beneath the benches, go get them,' one of the men ordered another," Khan said.
The black boots came towards him and Khan was shot in both legs below the knee.
"I felt searing pain. I folded my tie and pushed it into my mouth so that I wouldn't scream. The man with big boots kept on looking for students and pumping bullets into their bodies. I lay as still as I could and closed my eyes, waiting to be shot again. My body was shivering. I saw death so close. I will never forget the black boots approaching me -- I felt as though it was death that was approaching me."
A screengrab from television shows an injured boy being comforted. Photo / AFP
He waited until the men left then crawled to the next room where he saw the burned body of the school office assistant. He crawled behind a door to hide and passed out. When he woke he was in a hospital bed with his father beside him.
Student Hammad Ahmed said: "I was with my friends in the corridor in front of my class when we heard gunshots. We rushed inside the classroom, our teacher closed the door, she was trying to lock it when the terrorists kicked on the door and forced it open.
"All 10 of my classmates and our teacher died, only I survived."
Like Khan, he survived despite being shot in the feet because his attackers assumed he was dead.
Pakistan has lived with terrorist outrages for years, but the scale and cold-bloodedness of this attack resonated around the country.
Prime Minister Nawaz Sharif flew to Peshawar to monitor the operation. Announcing three days of national mourning, he said: "This was a national tragedy, unleashed by savages. No one should be in any doubt: this struggle, this war will continue. The Government started the anti-terrorist operation in conjunction with the army and it's now showing results. It will continue until terrorism is rooted out from this land ... We will take revenge for each and every drop of our children's blood that was spilled today."
Responsibility was quickly claimed by Tehreek-e-Taleban, the Pakistani Taleban, whose strongholds in North Waziristan, by the Afghan border, have been under sustained assault by the army since June. At least 1200 suspected militants are said to have died.
The spokesman for the group, Muhammad Umar Khorasani, said: "We selected the army school for the attack because the Government is targeting our families and females. We want them to feel the pain."
Retired Major General Athar Abbas, a former army spokesman, told the BBC: "Six terrorists came in front of the school in a small Suzuki van. One got out and came to the school gate and blew himself up. When the security guards rushed to the spot, this allowed the others to get into the school.
"There was a function in the school, an assembly in the auditorium, saying farewell to ninth and 10th-grade students. They started firing in the auditorium and three of them blew themselves up."
Pakistani parents escort their children outside a school attacked by the Taliban. Photo / AP
Ahmed Rashid, a Pakistan security expert, said: "I think there were several messages. First of all, I think they attacked something that was very sensitive to the army: many of the soldiers and officers fighting the Taleban have their children in this school. So this is an attempt to demoralise the military.
"I think the second message is to do with Malala [Yousafzai]. Remember Malala has been receiving accolades from all over the world, and remember she was shot by the Taleban and she has been advocating education for all, and the Taleban have been very strongly opposing her view on education. So they are sending a very strong message that 'we don't like your schooling system and we want an Islamic system'.
"The third reason is that Peshawar has become almost ungovernable. Terrorism there is rampant. We know there are Taleban cells inside the city which the authorities have not been able to get at, so really they can attack practically anywhere."
An injured boy looks up from his hospital bed. Photo / AFP
Yousafzai, 17, who was shot by the Taleban in 2012, said: "I am heartbroken by this senseless and cold-blooded act of terror in Peshawar. I condemn these atrocious and cowardly acts and stand united with the Government and armed forces of Pakistan ... Along with millions of others around the world I mourn these children, my brothers and sisters, but we will never be defeated."
Pakistan has come under immense pressure, particularly from the United States, to confront this enemy in its midst, and after many delays a major assault got under way in June. Two weeks of bombing raids on Taleban strongholds around Miranshah, capital of North Waziristan, were followed by artillery and tank assaults that began in July. Half a million civilians fled.
"By targeting students and teachers in this heinous attack, terrorists have once again shown their depravity," US President Barack Obama said. "We stand with the people of Pakistan."
Tehreek-e-Taleban was formed after the 2007 siege of a mosque in Islamabad that ended in a bloody assault by the army. Thirteen militant groups united, their goals being resistance to the Pakistani state, imposition of sharia law and a plan to unite against Nato forces in Afghanistan -- though most of their attacks have been confined to Pakistani soil.
Although predominantly Pashtun like the original Afghan Taleban, it is not directly affiliated to the Afghan organisation.
Rare for children to be targets
Terrorist atrocities that kill even hundreds of civilians have become almost unremarkable, such is the weaponry available to those who would do harm, but it is rare to target children.
The only parallels in modern history are the attack by Islamist separatists on a school in Beslan, North Ossetia, and the "lone wolf" killing of scores of teenagers at a summer youth camp in Norway.
The 2004 Beslan siege by militants from Chechnya and Ingushetia bore close parallels to the attack in Peshawar. Gunmen seized Beslan's School Number One on September 1. They held hostage more than 1000 people, including 777 children, opening fire when their booby-traps began to explode and Russian forces moved in. At least 385 people died, including 156 children.
On July 22, 2011, Anders Breivik bombed government buildings in Oslo and then attacked a Labour party youth camp on the Norwegian island of Utoya, as a protest against immigration. Of his 77 victims, 55 were teenagers.
The biggest single loss of children to a terrorist attack may have been suffered by the Yazidi community in northern Iraq. Co-ordinated bombings by al-Qaeda in two towns in August 2007 were estimated to have killed 796 people - many of them children.
Nineteen children died in a nursery attached to a federal building in Oklahoma City, United States, bombed by two far-right activists, Timothy McVeigh and Terry Nichols, in 1995. In all 168 people were killed.
The nearest equivalent in Britain was the killing by Thomas Hamilton of 16 children and a teacher at Dunblane Primary School in 1996. The killer was motivated by personal grievance.
- Telegraph Group Ltd, Independent, AFP