Flag of Jordan
Flag of JordaniStock

A prominent and outspoken Jordanian writer was shot dead on Sunday in front of the courthouse where he had been on trial for posting a cartoon deemed offensive to Islam on social media, The Associated Press reported.

A Jordanian security official said the shooter was a former imam at a local mosque, and said the man had been motivated by his anger over the cartoon posted to Facebook by writer Nahed Hattar.

The shooting was the latest in a string of deadly security lapses in Jordan, noted AP.

Witnesses and police said Hattar, 56, was preparing to enter the courthouse for a hearing when the gunman shot him at close range.

The witness said the shooter, who was immediately arrested, was wearing a long grey robe and long beard characteristic of conservative Muslims.

Jordanian media identified the shooter as Riad Abdullah, 49, a former imam in northern Hashmi, a poor neighborhood in Amman.

The reports said Abdullah had recently returned from a trip abroad, but gave no further details.

A security official who spoke to AP declined to confirm the suspect's name, but said he had confessed to the shooting and claimed he had acted alone and had no connections to any militant group.

Prosecutors charged the man with premeditated murder, committing a deadly terrorist act and possession of an unlicensed weapon. The suspect was detained for 15 days while the case was referred to the State Security Court.

According to AP, the cartoon posted by Hattar depicted a bearded man – assumed to be the Muslim Prohpet Mohammed – smoking and in bed with two women, asking God to bring him wine and cashews.

Insulting the Prophet Mohammed is viewed upon sternly in the Muslim world. Cartoons of the prophet deemed to be insulting to him have already enraged Muslims around the world on several occasions and are linked to several terrorist attacks in recent years.

Last January, gunmen killed 12 people at the Paris office of the satirical magazine Charlie Hebdo in anger at the magazine's cartoons featuring the Prophet. The magazine had previously been targeted over its portrayal of Mohammed.

In another incident, a competition featuring Mohammed cartoons in a suburb of Dallas, Texas came under attack by two gunmen. Police in Arizona later stepped up security near a mosque in Phoenix, where protesters from an anti-Islam group planned to draw cartoons of the prophet.

In 2012, the "Innocence of Muslims" film, which depicted the Muslim prophet as a thuggish deviant, triggered a wave of violent protests in the Muslim world that left dozens dead.

Joranian government spokesman Mohammad Momani condemned Hattar's killing as a "heinous crime", saying, according to AP, “The government will strike with an iron hand all those who exploit this crime to broadcast speeches of hatred to our community.”

Hattar has long been a controversial figure in Jordan, the news agency noted. Years ago, he claimed that the late King Hussein had arrested and tortured him many times for his critical writings and vowed not to mourn the king, who died in 1999.

While born a Christian, he considered himself an atheist. He was a strong supporter of Syrian President Bashar Al-Assad and an outspoken critic of the Islamic State group and of Al-Qaeda.

Hattar was detained in August after sharing the cartoon on Facebook. Relatives said the cartoon was meant to illustrate what Hattar viewed as the twisted religious views of Islamic State extremists.

The post was quickly deleted after it resulted in many angry responses.