British politicians have united in condemnation of a Taliban attack on a school in Pakistan which has claimed the lives of at least 126 people - a large majority of them thought to be children.
Prime Minister David Cameron said the scenes unfolding in the city of Peshawar were "horrifying", while Labour leader Ed Miliband said it was "appalling" that schoolchildren should be targeted.
A Pakistani military source told US TV network NBC that at least 10 attackers wearing police uniforms and suicide vests stormed the army-run school this morning. The gunmen were reported to have fired at random inside the school before the building was surrounded by Pakistani troops, who exchanged fire with the militants.
"They burnt a teacher in front of the students in a classroom," said the unnamed military source. "They literally set the teacher on fire with gasoline and made the kids watch."
Most of the school's 500 children are understood to have been evacuated, but many were being held hostage in the building. A Pakistani official put the death toll at 126.
Mr Cameron said: "The news from Pakistan is deeply shocking. It's horrifying that children are being killed simply for going to school."
Mr Miliband added his voice to the outrage, saying: "Devastating news from Pakistan. Appalling that schoolchildren were targeted in this murderous attack. My thoughts are with those affected."
Gunfire and explosions were heard shortly after the militants entered the school at around 10am local time (5am UK time). A number of teachers and a member of the security forces were believed to be among those killed.
The school is sited on the edge of a military cantonment in the city of Peshawar, and some of the pupils are thought to be the children of members of the armed forces.
Taliban spokesman Mohammed Khurasani said six suicide bombers had carried out the attack in revenge for the killing of Taliban members by Pakistani forces.
"We targeted the school because the army targets our families. We want them to feel our pain," said a Taliban spokesman.
Hundreds of Taliban fighters are thought to have died in a recent military offensive in Waziristan and the Khyber region.
Pakistani Prime Minister Nawaz Sharif, who described the attack as a "national tragedy", told reporters in Peshawar: "I feel that until and unless this country is cleansed from terrorism, this war and effort will not stop, no-one should be doubtful of this.
"Such attacks are expected in the wake of a war and the country should not lose its strength."
News images of the aftermath of the attack showed boys in blood-soaked school uniforms with green blazers being carried from the scene.
Police officer Javed Khan said army commandos quickly arrived at the school and exchanged fire with the gunmen.
Pakistani television showed soldiers surrounding the area and pushing people back.
One of the wounded students, Abdullah Jamal, was shot in the leg during a first-aid class.
"I saw children falling down who were crying and screaming," he said. "I also fell down. I learned later that I have got a bullet. All the children had bullet wounds. All the children were bleeding."
Politician and former Pakistan cricket captain Imran Khan said: "Shocked at attack on school in Peshawar. Strongly condemn this inhuman act of utter barbarism."
Former prime minister Gordon Brown, who has campaigned for security in schools in his role as United Nations special envoy for global education, said: "The whole world will be shocked and heartbroken at the massacre in Peshawar that has destroyed so many innocent young lives.
"Prime Minister Sharif has called the attack a national tragedy and our thoughts are with families and school friends. Our hope is that emergency assistance can come immediately to those who are injured.
"We must remain resolute in saying that no terrorist group can at any time ever justify denying children the right to an education and we will do everything in our power to support the Pakistan authorities and make sure their schools are safe and protected.
"It has never been acceptable for schools to be places of conflict and for children to be subject to violence simply because they want to learn. Education is opportunity and hope for building nations.
"Too often innocent girls and boys have become targets for terrorists who want to deny children the right to education and schools have become theatres of war.
"No-one has the right to deny a boy or girl their education and we will stand alongside the parents and the children against the Taliban's refusal to recognise every child has the right to education."
Indian Prime Minister Narendra Modi said on Twitter: "Strongly condemn the cowardly terrorist attack at a school in Peshawar.
"It is a senseless act of unspeakable brutality that has claimed lives of the most innocent of human beings - young children in their school.
"My heart goes out to everyone who lost their loved ones today. We share their pain and offer our deepest condolences."
Peshawar is a city of more than 3 million people situated in the north-west of Pakistan, close to the Khyber Pass crossing into Afghanistan.
Over the decades since the Soviet occupation of Afghanistan in the 1980s, it has housed many thousands of refugees seeking to escape unrest in its troubled neighbour, and it has been used as a base by Afghan fighters.
Khyber Pakhtunkhwa, the province of which Peshawar is the capital, has been a focus of the struggle between the authorities and the Pakistani Taliban, and the city itself has been the scene of a string of militant murders, abductions and bombings, most notably a 2009 car bomb which killed 137.
Former Foreign Office minister Baroness Warsi expressed "utter condemnation for this barbaric targeting of children".
"My thoughts and prayers are with the families in Pakistan who today mourn the death of their loved ones," she said.
"Terrorism in Pakistan will only be defeated if politicians, army and intelligence services are prepared to work together to the same agenda."
Labour MP for Glasgow Central Anas Sarwar, whose father Mohammad is governor of Pakistan's Punjab province, said: "Heartbreaking news from Pakistan. Reminds us what we take for granted every day - the right to send our kids to school to learn with no fear."
Bolton South East MP Yasmin Qureshi described the "gut-wrenching" scenes as "an utterly barbaric and inhumane attack on innocent children".
Mohammed Shafiq, chief executive of the UK-based Ramadhan Foundation, condemned the "brutal and evil" assault as "an attack against all Pakistanis" and "an affront to Islam".
"I urge Pakistani political parties to postpone their protests and stand with the victims and their families," said Mr Shafiq. "Terrorism is a cancer within Pakistan and needs to be removed permanently.
"As a parent I cannot imagine what the parents are going through, they remain in my prayers and hearts. There is no justification for this barbarism and we as Muslims reject these utter heartless people. We urge all Pakistanis to unite against the Taliban and all terrorist groups"
The leader of Pakistan's MQM party, Altaf Hussain, said: "Words are not enough to express our grief and condemn this heinous attack. Our prayers and wishes are with the teachers, children and their families.
"I call upon the authorities to take all necessary action to bring the perpetrators of the abhorrent attack to justice."
Deputy Prime Minister Nick Clegg said he was "shocked and appalled by the unimaginable horror taking place in Pakistan".