Journalism student Mashal Khan was beaten to death on a university campus after being accused of blasphemy.
Eight Pakistani students accused of being involved in the mob lynching of a classmate over allegations of blasphemy have been charged with murder and terrorism, court officials said on Saturday.
Mashal Khan, a journalism student, was stripped, beaten, shot, and thrown from the second floor of his hostel at the Abdul Wali Khan university in the northwestern town of Mardan by a large mob on Thursday.
"Eight students were presented before an anti-terrorism court in Mardan over murder and challenging the writ of the state," public prosecutor Rafiullah Khan said.
A total of 12 people have been arrested in the incident while the police is searching for more suspects.
On Friday, a local mosque Imam who was also Mashal Khan's primary school teacher refused to lead the prayer at the funeral, said Mashal's father Iqbal Shayir.
Shayir said he hoped his son's murder would "evoke realisation among people that killing an innocent is a sin."
A graphic video footage from the crime scene has showed dozens of men outside the hostel kicking and hurling projectiles at a body sprawled on the ground.
Students had previously complained to university authorities about Khan's "secular and liberal views" and he had been in a heated debate during a class the day he was killed.
Prime Minister Nawaz Sharif said on Saturday that he was "shocked and saddened", his first statement on Thursday's killing.
"Let it be known to the perpetrators of this act that the state shall not tolerate citizens taking the law into their own hands," Sharif said.
"The nation should stand united to condemn this crime and to promote tolerance and rule of law in society," he added.
Rights activists and civil society organisations held small protests in several Pakistani cities on Saturday condemning the murder and the UN in Pakistan released a statement calling for justice.
"We urge the authorities to take firm action and bring the perpetrators to speedy justice," said Neil Buhne, UN resident coordinator in Pakistan.
"Pakistan has strong legal institutions and it is unacceptable for anyone to take the law into their own hands," he added.
The independent Human Rights Commission of Pakistan (HRCP) has urged that all those involved in the lynching be brought to justice.
"The state's abject failure to protect Mashal Khan's right to life has created great panic and horror among students and academia. Unless all those who played any part in Mashal's brutal murder are brought to justice, such barbarity will only spread," it said.