By Suleiman Al-Khalidi

AMMAN (Reuters) - Protesters in Jordan demanded that the government resign on Monday for its failure to protect a Christian writer shot dead outside a court where he was to stand trial after sharing on social media a cartoon image seen as insulting Islam.

Hundreds of demonstrators gathered near the Prime Minister's office after writer Nahed Hattar was shot by a former Muslim preacher on the steps of the palace of justice on Sunday. The assailant gave himself up to the police near the scene.

"No to extremism, no to violence," and "Down with the government," shouted protesters carrying pictures of the slain writer, known for his support for Syrian President Bashar al-Assad and extremist nationalist views.

His death has shaken a country unaccustomed to such killings and raised fears of tensions between Muslims and the minority Christians who wield political and economic influence.

Hattar was arrested last month after sharing on social media a cartoon image of a bearded man in heaven smoking in bed with women and asking God to bring him wine and clear away his dishes.

The writer was released on bail but charged with contempt of religion and inflaming religious tension under the country's strict blasphemy laws.

Family members said the government failed to provide Hattar him with protection after he was released on bail, even after he had received death threats. They have so far refused to collect his body for burial.

"We demand at the very least the dismissal of the prime minister," Khaled Hattar, the writer's brother, told Reuters at the protest.

A source familiar with the case said the gunman had told interrogators that he acted on his own.

Jordanians have condemned the killing, although the cartoon had angered many people in a majority Muslim country where Hattar was accused of disseminating hatred and mocking Islam.

Hattar was a controversial figure whose calls for depriving Jordanians of Palestinian descent their political rights had won him many enemies in a country with a large Palestinian population.

His killing, however, has worried many liberal Muslims and Christians who now fear radical Islamists may feel emboldened to take violent action against their opponents.

UK-based rights group Amnesty International on Monday said the killing "was a deplorable attack on freedom of expression", saying strict blasphemy laws should be revoked. It called on the authorities to investigate the murder.

"Jordanian authorities must make it clear that attacks against people who peacefully express their views, however unpopular, will not be tolerated," said Philip Luther, Research and Advocacy Director for the Middle East and North Africa at Amnesty International in a release on Monday.

(Editing by Hugh Lawson)