A Jordanian judge has sentenced to death by hanging the man accused of killing Nahed Hattar, a Christian writer, on the steps of a court earlier this year.

Riyad Ismail was handed the death penalty on Tuesday, state news agency Petra said.

Ismail shot Hattar at close range on September 25 as the writer was about to to enter a court in the Jordanian capital Amman. He was hit by three bullets.

Hattar, 56, had been on trial for blasphemy for sharing a cartoon on social media that was deemed offensive to Islam by many Jordanian Muslims.

READ MORE: Hundreds mourn Jordanian writer Nahed Hattar

Ismail, a 49-year-old computer engineer, worked for the education ministry.

He was arrested at the scene and charged with premeditated murder, terrorism and possession of an illegal firearm.

Nahed Hattar was killed as he went on trial in September

Ismail appeared on Tuesday before the military court bearded, handcuffed and wearing a brown prison uniform.

Judge Ziad al-Edwan said  Ismail was sentenced "for having carried out deadly terrorist act".

The court also sentenced the man who sold Ismail the gun and the man who introduced him to the weapons merchant, each to one year in jail.

Hattar, a leftist, had been arrested on August 13 after posting a cartoon on Facebook under the title "God of Daesh", which uses the Arabic abbreviation for the Islamic State of Iraq and the Levant (ISIL).

He was later released on bail.

He explained on Facebook that the cartoon made fun of "terrorists and how they imagine God and heaven, and does not insult God in anyway".

His murder, which King Abdullah II branded a "heinous crime", prompted protests in Jordan, with demonstrators calling on the government to resign.

Source: News agencies