Two Palestinians armed with a meat cleaver and a gun killed four people in a Jerusalem synagogue before being shot dead by police.

Israeli Prime Minister Benjamin Netanyahu pledged to respond with a "heavy hand" and again accused Western-backed Palestinian President Mahmoud Abbas of inciting violence in Jerusalem.

Abbas issued a statement condemning the attack, the first time he has directly denounced violence after weeks of deepening unrest.

jerusalem synagogue
Israeli emergency services members carry a body at the scene of an attack by two Palestinians on worshippers at a synagogue in the ultra-Orthodox Har Nof neighbourhood in JerusalemAFP
Jerusalem synagogue attacks
A member of the Israeli Zaka emergency response team holds bloody clothes and a prayer shawl at the synagogueReuters
jerusalem synagogue
An armed Israeli police officer gestures near the scene of an attack at a Jerusalem synagogueReuters

A worshipper who attended the morning service in the Kehillat Bnei Torah synagogue in an ultra-Orthodox neighborhood of West Jerusalem said about 25 people were praying when shooting broke out.

"I looked up and saw someone shooting people at point-blank range. Then someone came in with what looked like a butcher's knife and he went wild," the witness, Yosef Posternak, told Israel Radio.

The founder of Israel's Zaka emergency response service, which attended the scene, described it as like the slaughter of Jews in Europe during the Holocaust.

"The images I saw inside the synagogue reminded me of images from the Holocaust - Jews wrapped in talitot (prayer shawls) and tefilin (phylacteries) dying in pools of their own blood on the floor of the synagogue," Yehudi Meshi Zahav told Israel Radio.

Jerusalem synagogue attacks
Blood trails are seen on the floor near covered bodies at the scene of an attack at a Jerusalem synagogueReuters
jerusalem synagogue
An Israeli emergency services member cleans blood off the pavement outside the synagogue in the ultra-Orthodox Har Nof neighbourhood of JerusalemAFP
Jerusalem synagogue attacks
An Ultra-orthodox Jewish man prays at the synagogue where two Palestinians armed with a gun and cleaver killed four Israelis before being shot deadAFP

Palestinian radio reports described the attackers as "martyrs" and the Islamist group Hamas praised the attack. Loudspeakers at mosques in Gaza called out congratulations. However, there was no direct claim of responsibility.

Palestinian media named the attackers as Ghassan and Udai Abu Jamal, cousins from the Jerusalem district of Jabal Mukaber, and said they were members of a small militant group.

Jerusalem synagogue attacks
Cousins Uday and Ghassan Abu Jamal are believed to be the perpetrators of the Jerusalem synagogue attackTwitter
Jerusalem synagogue attacks
Masked Palestinians holding axes and a gun celebrate an attack on a Jerusalem synagogue, in Rafah in the southern Gaza StripReuters

Violence in Jerusalem, areas of Israel, and the Israeli-occupied Palestinian territories, has surged in the past month fuelled in part by a dispute over Jerusalem's holiest shrine, which has given rise to fears of a religious conflict.

Five Israelis and a foreign visitor have been deliberately run over or stabbed to death by Palestinians. About a dozen Palestinians have also been killed, including those accused of carrying out those attacks.

Dome of the Rock Jerusalem
November 14, 2014: Palestinian worshippers take part in Friday prayers outside the Dome of the Rock at the Al-Aqsa mosque compound in the Old City of JerusalemAFP
al-aqsa mosque Jerusalem
November 14, 2014: A Palestinian protester kicks a flaming tyre towards Israeli soldiers near the Qalandia checkpoint to protest against the decision to allow Israeli settlers to enter the Al-Aqsa mosque compoundAFP
jerusalem
November 14, 2014: A Palestinian prepares to hurl a rock at Israeli soldiers during clashes near the Qalandia checkpoint between the West Bank city of Ramallah and Jerusalem, to protest against Israeli authorities allowing settlers to enter the Al-Aqsa mosque compoundAFP
israel barrier
November 14, 2014: Protesters use a metal ramp to cross over a section of the controversial Israeli barrier near the Israeli Qalandia checkpoint between the West Bank city of Ramallah and JerusalemReuters
israel barrier
A Palestinian protester tries to hammer a hole through Israel's controversial barrier that separates the West Bank town of Abu Dis from JerusalemAFP

Residents trace the violence in Jerusalem to July, when a Palestinian teenager was burned to death by Jewish assailants, an alleged revenge attack for the abduction and killing of three Jewish teens by Palestinian militants in the occupied West Bank.

The summer war between Israel and Hamas militants in Gaza has also been a trigger for violence.