The first funerals have been held for the victims of the Taliban school massacre in Pakistan.

At least 132 children and nine staff were killed in the city of Peshawar.

The seven Taliban attackers involved in the attack were killed in the battle with the army.

Pakistani Prime Minister Nawaz Sharif announced three days of national mourning.

He described the attack as a "national tragedy unleashed by savages" and lifted the moratorium on the death penalty.

The Pakistani Taliban said the attack was in revenge for the army's ongoing campaign against it.

The attack sparked condemnation worldwide and led the Pakistani government and military to reaffirm their determination to defeat a group that has killed thousands since it began its insurgency in 2007.

Teenage survivor Shahrukh Khan, who ducked below his desk with classmates when four gunmen burst into their room, described how he played dead after being shot in both legs, stuffing his tie into his mouth to stifle his screams.

"I saw a pair of big black boots coming towards me, this guy was probably hunting for students hiding beneath the benches," the 16-year-old said from the trauma ward of the city's Lady Reading Hospital. 

"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 get shot again," he said.

"My body was shivering. I saw death so close and I will never forget the black boots approaching me. I felt as though it was death that was approaching me."

Chief military spokesman General Asim Bajwa said that 125 people had been wounded in the assault.

The death toll exceeded the 139 killed in blasts targeting former prime minister Benazir Bhutto in Karachi in 2007.

There were around 500 students in the school when the attack started, and Gen Bajwa said the attackers, equipped with ammunition and food to last "days", only wanted to kill.

"The terrorists started indiscriminate firing as they entered the auditorium so they had no intention of taking any hostages," he told reporters.

A senior security official told AFP that the authorities were investigating the nationality of the attackers since some were speaking in Arabic.

Meanwhile, the Afghan Taliban has condemned the raid, saying killing innocent children was against Islam.

"The Islamic Emirate of Afghanistan has always condemned the killing of children and innocent people at every juncture," the Afghan Taliban, which often target civilians, said in a statement.

"The intentional killing of innocent people, women and children goes against the principles of Islam and every Islamic government and movement must adhere to this fundamental essence.

"The Islamic Emirate of Afghanistan (the official name of the Taliban) expresses its condolences over the incident and mourns with the families of killed children."

The Afghan Taliban is loosely affiliated to the Pakistani Taliban, with both pledging allegiance to Mullah Omar.