A Muslim professor in Pakistan was sentenced to death Saturday for allegedly spreading anti-Islamic ideas on social media.

Junaid Hafeez was arrested in 2013 for allegedly displaying blasphemous content while a visiting university lecturer in the city of Multan. After his arrest, prosecutors claimed investigators retrieved anti-religious material from Hafeez's laptop.

In the past six years, he’s remained in solitary confinement because he would likely be killed if kept with the general population, according to local media. Three of those years were spent in the United States under a special program for Pakistani educators.

Saturday’s trial was held inside the jail where Hafeez is being detained because of security concerns. He was also fined half a million Pakistani rupees – the equivalent of $3,200.

Defense attorney Shahbaz Gormani says his client was wrongly convicted and plans to appeal the verdict.

Pakistan's controversial blasphemy law carries an automatic death penalty for anyone accused of insulting God, Islam or other religious figures.

PAKISTAN COURT CALLS FOR EX-LEADER MUSHARRAF TO BE HANGED, EVEN IF HE DIES BEFORE SERVING DEATH SENTENCE

While authorities have yet to carry out a death sentence for blasphemy, even the mere accusation can cause riots. Domestic and international human rights groups say blasphemy allegations have often been used to intimidate religious minorities and to settle personal scores.

A Punjab governor was killed by his own guard in 2011 after he defended a Christian woman, Aasia Bibi, who was accused of blasphemy.

CLICK HERE TO GET THE FOX NEWS APP

Bibi was acquitted in January after eight years on death row in a case that drew international media attention. Faced with death threats from Islamic extremists upon her release, she flew to Canada to join her daughters in May.

The Associated Press contributed to this report.