A Pakistani court has sentenced one person to death and five others to life imprisonment for lynching a student accused of blasphemy, a crime which sent shockwaves through the conservative Muslim country.

Mashal Khan, 23, was stripped, beaten and shot by a gang made up mostly of students last April before being thrown from the second floor of his dormitory at Abdul Wali Khan university in the north-western city of Mardan.

On Wednesday, an anti-terrorism court sentenced Imran Sultan Mohammad to death over his role in shooting Khan, a crime he confessed to earlier.

According to the defence lawyer, Saad Abbasi, 25 others were given three-year sentences and 26 of the accused were acquitted.

Ahead of the verdict, heavy security was enforced at the jail in the city of Haripur where the accused were detained, with the area cordoned off by police and elite commandos.

About 100 relatives of the accused students waited outside the prison walls as news of the verdict trickled out.

“A day will come that the judge will answer the God. The verdict he has announced is unjust,” said Waheedullah, whose son was given a three-year sentence.

The brutality of the attack, which was recorded on mobile phone cameras and posted online, stunned the public and led to widespread condemnation – including from prominent Islamic clerics. Protests erupted in several cities.

Students who took part were rounded up after being identified through CCTV footage from the university and video clips.

An official report released months later concluded Khan was falsely accused, saying the murder was instigated by members of a secular student group who felt threatened by Khan’s growing prominence as a critic of rising fees and of alleged corruption at the university.

Blasphemy is an enormously sensitive charge in Pakistan, and a criminal offence that can carry the death penalty. While the state has never executed anyone under blasphemy laws, mere allegations have prompted mob violence and lynchings.

Since 1990 vigilantes have been accused of murdering 65 people tied to blasphemy, according to research compiled by Pakistani thinktank the Center for Research and Security Studies.