A Pakistani court has sentenced one person to death and five other people to life imprisonment over the mob lynching of a student who was falsely accused of blasphemy in 2017.

Mashal Khan, a 23-year-old journalism student, was killed by a mob at the Abdul Wali Khan University in the northern city of Mardan on April 13, 2017. He was accused of posting "blasphemous content" on social media.

Saad Abbasi, a defense lawyer representing the accused, told the AFP news agency at the prison where the verdict was announced that 25 people received three-year prison sentences over the killing while another 26 were acquitted.

Heavy security was deployed at the prison in the city of Haripur where the accused were being tried. The area was cordoned off by some 300 police and elite commandos.

The ferocity of the attack, which was recorded on mobile phone cameras and posted online, shocked Pakistan and led to widespread condemnation -- including criticism from prominent Islamic clerics.

An official investigation later determined that Khan was falsely accused. It said the killing was instigated by members of a secular student group who felt threatened by Khan's growing prominence as a critic of rising fees and alleged corruption at the university.

Pakistan's controversial blasphemy laws, which seek death for insulting Islam or the Muslim Prophet Muhammad, were introduced by former military ruler General Muhammad Zia-ul Haq during the 1980s.

Rights activists argue that Pakistan's blasphemy laws are often misused by people trying to settle personal scores, mainly against the members of minorities.

In 2014, several hundred Muslim men bludgeoned a Christian man and his pregnant wife to death and threw their bodies in a burning brick kiln after the couple was accused of blasphemy.