He was preparing to enter the courthouse for a hearing when the gunman shot him at close range.
It is not known who produced the cartoon. Many Jordanian Muslims found the cartoon offensive and against their religion. Authorities said Hattar violated the law by widely sharing the caricature. He was charged with inciting sectarian strife and insulting Islam before being released on bail in early September. Spokesperson of the Jordanian government, Mohammad Momani, condemned Hattar's killing as a "heinous crime".
The gunman who shot him has been arrested and is to face investigation and trial.
Daoud Kuttab, an award-winning journalist and director of Community Media Network, told Al Jazeera Hattar's killing represents a "scary situation where people with opinions we don't like or the government doesn't like become susceptible to assassination".
"It's a clear case of intellectual terror," said Kuttab.
"The omen is that many people are now going to be worried about what they say ... It's a scary situation for people who believe in the freedom of thought and opinion and the right of expressing their opinion."