Taliban gunmen and suicide bombers have killed more than 140 students and teachers at an army-run school in the northern city of Peshawar.

The chief spokesman for the Pakistani Army, Asim Bajwa, said six Taliban militants have been killed but IEDs planted by the terrorists made the evacuation of hostages difficult.

Shortly before 6.30pm local time - more than eight hours after the attack started - police said that all militants were dead and the siege was over, AFP reported.

Military officials said 141 people - including 132 children and nine staff members - were among the dead and many more were injured at the Army Public School.

Many were believed to be killed in a suicide blast after the attack started at 10am local time and further explosions were heard later in the day.

Military sources said one teacher was doused with petrol and burned alive in front of pupils who were forced to watch and a suicide bomb was reportedly detonated in a room containing 60 children.

There were unconfirmed claims that children from military families were separated from their peers and shot in the head.

A soldier escorts schoolchildren after they were rescued from the Army Public School (Reuters)

Soldiers had swept the school as the siege started, evacuating the "bulk" of students and teachers from classrooms and rescuing small groups as the day continued.

A spokesperson for the Taliban told international media that suicide bombers had been sent into the Army Public School to target army personnel and their families but were ordered not to harm young children.

Muhammad Khorasani told AFP: “They [military] was always wrong about our capabilities. We are still able to carry out major attacks. This was just the trailer.”

He said the massacre revenge for an anti-terrorist operation launched by Pakistan's army, targeting the school because of its military association.

“We selected the army's school for the attack because the government is targeting our families and females,” Khorasani said. “We want them to feel the pain.”

There were fears the death toll could rise after three loud bangs believed to be explosions were heard hours after the siege began. Ambulances were seen entering the school area and security sources reportedly believe there are bodies still inside.

A plainclothes security officer escorts students rescued from nearby school during a Taliban attack in Peshawar

Shah Farman, the Khyber Pakhtunkhwa Minister of Information, said between 80 and 100 people were believed to be dead.

"The army is trying hard to bring the situation under control," he added. "The operation is currently underway.

"It is unfortunate that schoolchildren were targeted. We need the country to be united and we need justice."

A plainclothes security officer escorts students rescued from nearby school during a Taliban attack in Peshawar

Pakistan's Prime Minister, Nawaz Sharif, has travelled to the scene of the attack in Peshawar.

"These are my children and it is my loss," he said.

Journalists at the scene could hear heavy gunfire from inside the school as soldiers surrounded it and ambulances took wounded children to the hospital.

“We were standing outside the school and firing suddenly started and there was chaos everywhere and the screams of children and teachers,” said Jamshed Khan, a school bus driver.

About 500 students and teachers were believed to be inside at the time, with some taking first aid lessons.

"After half an hour of the attack, the army came and sealed the school," a teacher who escaped told a private television channel.

"We were in the examination hall when the attack took place," he said. "Now the army men are clearing the classes one by one."

One of the wounded students, Abdullah Jamal, said that he was with a group of teenagers who were getting first aid training with a team of Pakistani army medics when the violence began.

He said no one realised what was happening until they "saw children falling down who were crying and screaming" as they were shot.

"I also fell down. I learned later that I have got a bullet,” he said from his hospital bed, where he was being treated for a gunshot wound to his leg.

“All the children had bullet wounds. All the children were bleeding."

Eyewitnesses said the attackers were dressed in army uniforms and set fire to a vehicle before entering the school and opening fire.

Military officials said at least six armed men had entered the Army Public School but did not confirm the number of casualties.

In pictures: Taliban attack on army school in Pakistan Show all 30 1 /30 In pictures: Taliban attack on army school in Pakistan In pictures: Taliban attack on army school in Pakistan Pakistan Women mourn the death of a relative who was killed during the attack on the Army Public School, in Peshawar Reuters In pictures: Taliban attack on army school in Pakistan Pakistan Sirajul Haq (3-R) head of the Islamic political party Jamat-e-Islami leads the funeral prayers of two school boys who were killed by Taliban militants at a school run by the Army, in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Schoolchildren take part in a prayer for victims of the Taliban attack on the Army Public School in Peshawar, in the northern Indian city of Mathura In pictures: Taliban attack on army school in Pakistan Pakistan Indian schoolchildren prepare lighted candles ahead of a vigil in the northern city of Jalandhar, as they pay tribute to slain Pakistani schoolchildren and staff after an attack on an army school in the restive city of Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Pakistani journalists in Islamabad attend a vigil for the victims of the attack EPA In pictures: Taliban attack on army school in Pakistan Pakistan Chairs are upturned and blood stains the floor at the Army Public School auditorium the day after Taliban gunmen stormed the school in Peshawar, Pakistan AP In pictures: Taliban attack on army school in Pakistan Pakistan The uncle and cousin of injured student comfort him as he mourns the death of his mother who was a teacher at the school which was attacked by Taliban AP In pictures: Taliban attack on army school in Pakistan Pakistan Pakistani schoolgirls pray for victims, who were killed in an attack at the Army-run school in Peshawar, during a memorial ceremony in their school in Hyderabad, Pakistan, EPA In pictures: Taliban attack on army school in Pakistan Pakistan A Pakistani girl, who was injured in a Taliban attack in a school, is rushed to a hospital in Peshawar AP Photo/Mohammad Sajjad In pictures: Taliban attack on army school in Pakistan Pakistan A man carries a student, who was injured during an attack by Taliban gunmen on the Army Public School, after he received treatment at a hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Rescue workers and family members carry the coffin of a student, who killed during an attack by Taliban gunmen on the Army Public School, in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Relatives of a student, who was injured during an attack by Taliban gunmen on the Army Public School, comfort each other outside Lady Reading Hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan People carry the casket of a victim of Taliban attack in a school, after receiving it from a local hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A Pakistani woman reacts as she arrives near the site of an attack by Taliban gunmen on a school in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A plainclothes security officer escorts students rescued from nearby school during a Taliban attack in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Pakistani volunteers carry a student injured in the shootout at a school under attack by Taliban gunmen, at a local hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A school boy who was injured in a Taliban attack receives medical treatment at a hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Hospital staff transport a student injured in the shootout at a school under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A Pakistani woman weeps as she waits at a hospital, where victims of a Taliban attack are being treated in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A hospital security guard helps a student injured in the shootout at a school under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A soldier escorts schoolchildren from the Army Public School that is under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Schoolchildren stand outside after being rescued from the Army Public School that in under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A Pakistani army soldier takes position on a bunker close to a school under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A rescue worker waves to make way for an ambulance as it speeded away form a school that was attacked by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A school boy who was injured in a Taliban attack receives medical treatment at a hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A school boy who was injured in a Taliban attack receives medical treatment at a hospital in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A man talks on a phone, with his arm around a student, outside a military run school that is under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Schoolchildren cross a road as they move away from a military run school that is under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan Pakistani army troops cordon off a road leading to a school under attack by Taliban gunmen in Peshawar In pictures: Taliban attack on army school in Pakistan Pakistan A school boy who was injured in a Taliban attack receives medical treatment at a hospital in Peshawar

"Our suicide bombers have entered the school, they have instructions not to harm the children, but to target the army personnel,” a spokesperson for Tehreek-e-Taliban Pakistan (TTP), or Pakistani Taliban, told Reuters.

"It's a revenge attack for the army offensive in North Waziristan," he said, referring to an anti-Taliban military offensive that started in June.

David Cameron expressed his sympathy on Twitter. "The news from Pakistan is deeply shocking," he wrote. "It's horrifying that children are being killed simply for going to school."