Image copyright AP Image caption The school's auditorium was where most of the children were killed

Pakistan has hanged four men linked to last December's massacre at an army school which killed more than 150 people, mostly children.

The men were sentenced to death by a military court and are the first to be hanged in relation to the attack.

Taliban militants stormed the Army Public School in the north-western city of Peshawar on 16 December 2014.

The hangings come just two weeks ahead of the anniversary of the attack, which shocked the nation.

The massacre prompted a crackdown on Islamist militants, the establishment of military courts to try terror suspects and the resumption of capital punishment after a six-year moratorium.

Secret courts: M Ilyas Khan, BBC News, Islamabad

These executions are timed to coincide with the first anniversary of the Peshawar school massacre. The trials were held in a military court, and proceedings were shrouded in secrecy.

A recent military statement claimed the convicts were linked to the little-known Toheedwal Jihad group of the Pakistani Taliban. It said they had admitted to involvement in previous attacks on military targets, including the 2012 assault on the air force base in Peshawar. But it did not specify how they were linked to the Army Public School shootings of last December.

There is no way of knowing if they were provided adequate legal defence, or if they appealed against their convictions in the military court of appeals, which is allowed under the law.

After the school attack, the government decided to set up military courts to try civilians involved in terrorism. The move was opposed by human rights groups who argued it would lead to miscarriages of justice and summary executions.

Image copyright AFP Image caption The incident shocked the country and led to a crackdown on Islamist militants

'Shooting indiscriminately'

Earlier this week, army chief Gen Raheel Sharif signed death warrants for the four militants who were named as Maulvi Abdus Salam, Hazrat Ali, Mujeebur Rehman and Sabeel.

Security officials said the four men were executed early on Wednesday at a jail in the north-western city of Kohat.

Image copyright AP Image caption Most of those who died in the attack at the military-run school were young boys

They were convicted in a military court of aiding and abetting the militants who carried out the attack, all of whom were killed in battle with security forces on the day.

During the assault, militants scaled the walls to get into the school and set off a bomb before moving from classroom to classroom shooting indiscriminately at both children and teachers.

The school was near a military complex in Peshawar and a number of its students were the children of military personnel.

"The rest should be caught too, no-one should be spared," Waheed Anjum, an 18-year-old survivor of the attack, told AFP news agency.

"The hangings won't bring back my son, but now other people's sons will be kept safer," said Tufail Ahmed Khan, who lost one son in the attack while another was wounded.

Peshawar, which is close to the Afghan border, has seen some of the worst of the militant violence to assail the country over the last decade.

The Pakistani authorities believe 27 militants were involved in the attack. Nine were killed during the siege and officials say 12 suspects were arrested.

In all, six men were sentenced to death in August after secret military trials. A seventh was given life in jail, while two of the condemned men are still to be hanged.

How many other suspects were caught, or remain in custody, is unclear.