Militants from the Pakistani Taliban have attacked an army-run school in Peshawar, killing 141 people, 132 of them children, the military say.
Officials say the attack in the north-western city is over, with all the attackers killed. Seven militants took part in all, according to the army.
Scores of survivors are being treated in hospitals as frantic parents search for news of their children.
The attack - the Taliban's deadliest in Pakistan - has been widely condemned.
Describing the attack from his hospital bed to the BBC's Shaimaa Khalil, Shahrukh Khan, 17, said a gunman had entered his classroom and opened fire at random.
As he hid under a desk, he saw his friends being shot, one in the head and one in the chest. Two teachers were also killed.
A Taliban spokesman told BBC Urdu that the school, which is run by the army, had been targeted in response to military operations.
Hundreds of Taliban fighters are thought to have died in a recent offensive in North Waziristan and the nearby Khyber area.
US President Barack Obama said terrorists had "once again shown their depravity" while UN Secretary General Ban Ki-moon said it was "an act of horror and rank cowardice".
Analysis: Aamer Ahmed Khan, BBC News
This brutal attack may well be a watershed for a country long accused by the world of treating terrorists as strategic assets.
Pakistan's policy-makers struggling to come to grips with various shades of militants have often cited a "lack of consensus" and "large pockets of sympathy" for religious militants as a major stumbling-block.
That is probably why, when army chief Gen Raheel Sharif launched what he called an indiscriminate operation earlier in the year against militant groups in Pakistan's lawless tribal belt, the political response was lukewarm at best.
We will get them, was his message, be they Pakistani Taliban, Punjabi Taliban, al-Qaeda and affiliates, or most importantly, the dreaded Haqqani network. But the country's political leadership chose to remain largely silent. This is very likely to change now.
Late on Tuesday, military spokesman Asim Bajwa told reporters in Peshawar that 132 children and nine members of staff had been killed.
All seven of the attackers wore suicide bomb vests, he said. Scores of people were also injured.
It appears the militants scaled walls to get into the school and set off a bomb at the start of the assault.
Children who escaped say the militants then went from one classroom to another, shooting indiscriminately.
One boy told reporters he had been with a group of 10 friends who tried to run away and hide. He was the only one to survive.
Others described seeing pupils lying dead in the corridors. One local woman said her friend's daughter had escaped because her clothing was covered in blood from those around her and she had lain pretending to be dead.
Deadly attacks in Pakistan
16 December 2014: Taliban attack on school in Peshawar leaves at least 141 people dead, 132 of them children
22 September 2013: Militants linked to the Taliban kill at least 80 people at a church in Peshawar, in one of the worst attacks on Christians
10 January 2013: Militant bombers target the Hazara Shia Muslim minority in the city of Quetta, killing 120 at a snooker hall and on a street
28 May 2010: Gunmen attack two mosques of the minority Ahmadi Islamic sect in Lahore, killing more than 80 people
18 October 2007: Twin bomb attack at a rally for Benazir Bhutto in Karachi leaves at least 130 dead. Unclear if Taliban behind attack
A hospital doctor treating injured children said many had head and chest injuries.
Irshadah Bibi, a woman who lost her 12-year-old son, was seen beating her face in grief, throwing herself against an ambulance.
"O God, why did you snatch away my son?" AFP news agency quoted her as saying.
The school is near a military complex in Peshawar. The city, close to the Afghan border, has seen some of the worst of the violence during the Taliban insurgency in recent years.
Many of the students were the children of military personnel. Most of them would have been aged 16 or under.
Pakistani Taliban spokesman Mohammad Khurasani said the militants had been "forced" to launch the attack in response to army attacks.
Leading figures in Pakistan expressed grief and indignation
- Pakistani Nobel laureate Malala Yousafzai said she and millions of others would mourn the dead children, her "brothers and sisters", adding "we will never be defeated"
- Prime Minister Nawaz Sharif spoke of a "national tragedy"
- Pakistani opposition leader and former cricket captain Imran Khan condemned the attack as "utter barbarism"