A gunman shot dead Jordanian writer Nahed Hattar on Sunday outside the court where he was to stand trial on charges of contempt of religion after sharing on social media a caricature seen as insulting Islam, witnesses and state media said.
The gunman was arrested at the scene, state news agency Petra said. A security source said he was a 39-year-old Muslim preacher in a mosque in the capital.
Hattar, a Christian and a anti-Islamist activist who was a supporter of Syrian President Bashar al-Assad, was arrested last month after he shared a caricature that depicted a bearded man in heaven smoking in bed with women and asking God to bring him wine and cashews.
In the cartoon, the man also asks God to clear his dishes and put a door on his tent and knock before entering.
Many conservative Muslim Jordanians considered Hattar's move offensive and against their religion. The authorities said he violated the law by sharing the caricature.
The state news agency quoted a security source as saying Hattar was killed by a man who fired three shots at him on the steps of the palace of justice in the Jordanian capital.
"The assailant was arrested and investigations are ongoing," Petra quoted the security source as saying.
Two witnesses said the gunman was wearing a traditional Arab dishashada, worn by ultra conservative Sunni Salafis who adhere to a puritanical version of Islam and shun Western lifestyles.
Some secular and liberal supporters of Hattar said his arrest last month was a breach of freedom of speech but other Jordanians thought the caricature's publication had crossed a red line in a Muslim country where it is a taboo to attack God or the Prophet.
Hattar was charged with contempt of religion and sowing sectarian tensions. The country's highest official religious fatwa authority criticised Hattar for what it said was the "insult to the divine entity, Islam and religious symbols".
Hattar had apologized on social media and said he did not mean to insult God but had shared the cartoon to mock fundamentalist Sunni radicals and what he said was their vision of God and heaven. He had accused his Islamist opponents of using the cartoon to settle scores with him.
Hattar also supported restricting the rights and privileges of Jordanians of Palestinian descent.
The Jordanian government condemned the attack.
"The law will be strictly enforced on the culprit who did this criminal act and will hit with an iron fist anyone who tries to harm state of law," government spokesman Mohammad Momani said.
The moderate Islamist Muslim Brotherhood group also warned against a flare up in religious and sectarian tensions in a country in which Jordanian Christians are a minority but wield wide political and economic influence.