A court in Pakistan has sentenced a man to death for blasphemy, under strict laws against insulting Islam, despite lawyers for the defendant protesting that he was insane when he wrote the heretical slogans.

Zulfiqar Ali, a man in his 50s, was arrested in 2008 in Lahore and was charged with writing blasphemous slogans on walls.

His lawyer argued that he was insane but Judge Naveed Iqbal sentenced him to death Monday, the lawyer for the prosecution, Chaudhry Ghulam Mustafa, told AFP.

“Accused Zulfiqar Ali has committed the act of blasphemy by writing the abusive sentences towards the Holy Prophet on the walls of Nehru Park, Islampura. He was caught red handed. Police came there. He was also used to utter derogatory remarks on hearing the call for prayers,” the judge said in his ruling.

Ali was ordered to pay a fine of 1 million rupees ($10,000), otherwise he will have to spend a further year in jail before he is hung.

The man was brought straight to court from the psychiatric ward of the jail, according to his defense lawyer Kashif Ali Bokhari. The judge still said that he had found Ali mentally competent.

“I pleaded in the court that he was insane but this plea was ignored,” Bokhari said.

Pakistan has had a de-facto moratorium on civilian hangings since 2008, with just one soldier executed by court martial since then.

But blasphemy remains one of the most serious crimes in a country where the majority of the 180 million population are devout Muslims. A recent report by the US government listed 14 people on death row and another 19 serving life sentences for insulting Islam in the Asian country. Rights activists also say blasphemy laws are sometimes misused to settle personal disputes.