Pakistan is mourning as the nation prepares for mass funerals for 141 people, most of them children, killed in a Taliban attack on a military-run school in the country's northwest.

A three-day official mourning period started Wednesday, a day after seven Taliban gunmen, explosives strapped to their bodies, stormed the army public school in the city of Peshawar.

Students were gunned down and some of the female teachers were burned alive. Army commandos fought the Taliban in a day-long battle until the school was cleared and all the attackers dead.

The massacre was the deadliest slaughter of innocents in the country and horrified a nation already weary of unending terrorist attacks.

The Taliban said the attack was revenge for a military offensive against their safe havens in the northwest.