Palestinians in Gaza have celebrated the killing of four worshippers at a synagogue in Jerusalem, sparking outrage in Israel.

Men were photographed offering trays full of candy to dozens of people who took to the streets in Rafah and at the Jabalia refugee camp to celebrate the deadly attack in Jerusalem's ultra-Orthodox Har Nof neighbourhood.

Masked militants posed for pictures holding knifes and axes, as women scattered sweets to children amid wavering green Hamas flags and banners commemorating the assailants - who were shot dead by police.

The images drew anger and condemnation in Israel.

Human rights lawyer Arsen Ostrovsky tweeted:

Twitter user @Prosistency wrote:

Gaza was largely devastated by Israeli shelling during the two-month conflict that saw more than 2,100 Palestinians - three-quarters of whom were civilians - killed this summer.

The synagogue attack was carried out by two Palestinian cousins from east Jerusalem. Ghassan and Uday Abu Jamal, from the Jabel Mukaber neighbourhood, stormed the religious site killing a British Israeli and three Americans.

The Popular Front for the Liberation of Palestine (PFLP) claimed responsibility for the raid, which was also hailed by Hamas, the militant group that rules over Gaza.

Hamas spokesman Sami Abu Zuhri said the killings were in retaliation for the death of Yusuf Hassan al-Ramouni, a 32-year-old bus driver.

"Jerusalem attack is a reaction to the execution of the martyr al-Ramouni and the ongoing Israeli crimes at al-Aqsa," Abu Zuhri wrote on Facebook. "Hamas calls for the continuation of acts of revenge".

Al-Ramouni was found hanged inside his vehicle from a thin cord at the beginning of his route in a district close to both Jewish settlements and Palestinian neighbourhoods.

Israeli police said an autopsy carried out, in the presence of a Palestinian pathologist chosen by the family, confirmed it was suicide.

Palestinian President Mahmoud Abbas condemned the incident. "The presidency condemns the attack on Jewish worshippers in their place of prayer and condemns the killing of civilians no matter who is doing it," his office said in a statement.