Eight Pakistanis accused of killing a fellow university student over allegations of blasphemy have been charged with murder and "terrorism", according to court officials.

Mashal Khan, a journalism student, was stripped, beaten, shot and thrown from the second floor of his dorm at the Abdul Wali Khan university in the northwestern town of Mardan on Thursday by a large group of people.

Two other students were also wounded in the violent attack after being accused of committing blasphemy against Islam.

"Eight students were presented before an anti-terrorism court in Mardan over murder and challenging the writ of the state," public prosecutor Rafiullah Khan told the AFP news agency on Saturday.

READ MORE: Pakistan to meet Facebook over 'blasphemy' posts

Four others were arrested on Saturday, Khan said.

Graphic video footage from the crime scene showed dozens of men outside the dorm kicking and hurling projectiles at a body sprawled on the ground.

Mushtaq Ghani, information minister of northwestern Khyber Pakhtunkhwa province, said the government had also requested Peshawar High Court to conduct a judicial probe into the incident.

Students had previously complained to university authorities about the murdered student's alleged secular and liberal views and Khan had been in a heated debate during a class the day he was killed.

Blasphemy is a sensitive subject in Pakistan, where punishment for the crime ranges from a fine to a mandatory death sentence, depending on the specific offence.

"No one deserves to die the way Mashal did. We have law and orders placed in the country - no one can prove if Mashal did commit blasphemy," a witness, who wished to stay anonymous out of fear of being attacked, told Al Jazeera.

"This incident has impacted many students here and every time we walk by this university, it will remind us of Mashal and how he was killed."

Prime Minister Nawaz Sharif on Saturday condemned the murder and urged the nation to stand united in promoting tolerance.

"I am shocked and saddened by the senseless display of mob justice that resulted in the murder of a young student," Sharif said.

"Let it be known to the perpetrators of this act that the state shall not tolerate citizens taking the law in their own hands. No father should have to send his child off to be educated, with the fear of having him return in a coffin."

Currently, about 40 people are on death row or serving life sentences for blasphemy in Pakistan, according to the United States Commission on International Religious Freedom.

Increasingly, however, right-wing vigilantes and mobs have taken the law into their own hands, killing at least 69 people over alleged blasphemy since 1990, according to an Al Jazeera tally.

Those killed have included people accused of blasphemy, their lawyers, their relatives, judges hearing their cases and members of their communities.

READ MORE: In Pakistan, a shrine to murder for 'blasphemy'

The independent Human Rights Commission of Pakistan 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.

At his funeral on Friday, Khan's father said he hoped his son's murder would "evoke realisation among people that killing an innocent is a sin".