A prominent Jordanian writer was shot dead by a suspected Islamist gunman on Sunday outside the courtroom where he was due to stand trial for offending Islam by sharing a cartoon on Facebook.

Nahed Hattar, a 56-year-old intellectual from Jordan's Christian minority, was gunned down on the steps of a courthouse in Amman in what appeared to be a religiously motivated attack.

The gunman was arrested at the scene and a Jordanian security source identified him as Riyad Ismail Abdullah, a 49-year-old imam who was wearing traditional Islamic robes at the time of the shooting.

The alleged shooter recently returned from making the Hajj pilgrimage to Saudi Arabia, the source said. The gunman is believed to have acted alone rather than as part of an organised group.