Four Israelis were killed and eight more wounded in a frenzied assault by two Palestinian men on Jewish worshippers praying at a Jerusalem synagogue in the most lethal incident in the city in years.

The two assailants who launched their attack with meat cleavers and a gun during early morning prayers were then killed by police officers in the ensuing gun battle at the scene of the attack.

The deaths occurred as the two men – identified by family members as cousins Ghassan and Uday Abu Jamal from the East Jerusalem district of Jabal Mukaber – burst into the Bnei Torah synagogue in Har Nof, an ultra-Orthodox Jewish neighbourhood of West Jerusalem.

[[{“type”:”media”,”view_mode”:”media_large”,”fid”:”594169″,”attributes”:{“alt”:””,”class”:”media-image”,”height”:”368″,”typeof”:”foaf:Image”,”width”:”480″}}]]

Three of the victims held dual US-Israeli citizenship, and one was a British-Israeli citizen – 68-year-old Avraham Shmuel Goldberg, who emigrated to Israel from the UK in 1993.

The three US citizens were 59-year-old Rabbi Moshe Twersky – the head of an English speaking religious college – Aryeh Kopinsky, 43, and Kalman Zeev Levine, 55. The grandson of one of the founders of the Modern Orthodox movement, Twersky lived close to the scene of the attack in Har Nof.

HEARTBREAKING: Rosh Yeshiva Kollel Toras Moshe Rabbi Moshe Twersky HY"D killed in todays Jerusalem terror attack. pic.twitter.com/hhqj30xlO2 — Israel News Feed (@IsraelHatzolah) November 18, 2014

Witnesses including worshippers, residents and a first-aider who entered the synagogue while the attack was continuing, described a chaotic and bloody scene as police and the attackers engaged in a shootout at the building’s entrance.

Akiva Pollack, a paramedic who was one of the first on the scene, told the Guardian he had entered the synagogue to be confronted by an individual covered in blood.

“He said he had been shot but when he took his shirt off it was covered in deep cuts. I tried to treat him, but then I heard shooting nearby.”

Dragging one of the injured from the synagogue he reached the exit to see a policeman shot. “I tried to help him. I intubated him but he was badly wounded.”

Another medical volunteer who arrived early on the scene was Joyce Morel. She told Haaretz newspaper: “The gentleman I tended to first still had his tefillin on. There were also women there who didn’t know where their husbands were, and others who didn’t know where their father was. Those were most likely the ones killed. It was very hard to deal with, very upsetting.”

A man who identified himself only as Yossi and was in the synagogue at the time of the attack, told Channel 2: “The police arrived and surrounded the entrance and then the terrorist ran out and they shot him. There was wild gunfire. People ran out of the synagogue. It was hell.”

“I tried to escape. The man with the knife approached me. There was a chair and table between us … my prayer shawl got caught. I left it there and escaped.”

Yosef Posternak, who was also praying in the synagogue at the time of the attack, told Israel Radio that about 25 worshippers were inside when the attackers entered.

“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.” He added: “I saw people lying on the floor, blood everywhere. People were trying to fight with [the attackers] but they didn’t have much of a chance,” he said.

Pictures posted by an Israeli army spokesman showed a man in a Jewish prayer shawl lying dead, a bloodied butcher’s cleaver discarded on the floor and several overturned prayer tables.

Yakov Cohen, a 60-year-old pensioner who lives in an apartment block opposite the synagogue and had been preparing to go and pray himself, described seeing the gun battle.

“I was getting ready to go down and pray myself. My wife had gone out for a walk,” he told the Guardian. “She called to tell me there was shooting and to stay at home.

“I saw armed police at the door of the synagogue and then heard one of them shout: ‘He’s getting ready to come out.’ An Arab came out of the building – a man in his 30s – the police shot him as he came out.”

The attack is bound to ratchet up fears of sustained violence in the city, already on edge amid soaring tensions over a contested holy site.

The Popular Front for the Liberation of Palestine, a militant group, said the cousins were its members. A PFLP statement did not specify whether the group instructed the cousins to carry out the attack. Hamas, the militant Palestinian group that runs the Gaza Strip, also praised the attack.

Israel’s prime minister, Binyamin Netanyahu, vowed that Israel would “respond harshly” to the attack, describing it as a “cruel murder of Jews who came to pray and were killed by despicable murderers”.

The US secretary of state, John Kerry, said he spoke to Netanyahu after the assault and denounced it as an “act of pure terror and senseless brutality and violence”.

“Innocent people who had come to worship died in the sanctuary of a synagogue,” Kerry said, his voice quavering.

“They were hatcheted, hacked and murdered in that holy place in an act of pure terror and senseless brutality and murder. I call on Palestinians at every single level of leadership to condemn this in the most powerful terms. This violence has no place anywhere, particularly after the discussion that we just had the other day in Amman.”

The Palestinian president, Mahmoud Abbas, condemned the attack, the first time he has done so since a recent spike in deadly violence against Israelis began. He also called for an end to Israeli “provocations” surrounding the sacred site.

In a statement, Abbas’s office said he “condemns the killing of the worshippers in a synagogue in west Jerusalem”. The statement called for an end to the “invasion” of the mosque at the holy site and a halt to “incitement” by Israeli ministers.

In a bleak assessment of the recent wave of violence, the Israeli justice minister, Tzipi Livni, told Army Radio that she has long feared that is a becoming a religious war. “And a religious war cannot be solved.”

In Jabal Mukaber relatives of the two attackers offered different theories about the motives for the attack, with some linking it to the death of Palestinian bus driver found hanged behind his bus – described by Israeli authorities as a suicide – but widely believed by many palestinians to have been a “lynching”. Other family members, however, blamed recent friction at the Jerusalem holy site known to Muslims as the Noble sanctuary and to Jews as the temple Mount which has been blamed for a rash of deadly violence and clashes.

A cousin of the men, Sufian Abu Jamal, a construction worker aged 40, described it as a “heroic act and the normal reaction of what has been happening to Palestinians in jerusalem and at the Al Aqsa mosque.”

At the house of Uday, “Abu Salah”, an uncle of one of the men said his relatives had been made angry by what they had seen on Facebook and television news reports. “It was a situation rope for an explosion and that is what happened.”

Tuesday’s attack was the latest in a series of deadly assaults. Five Israelis and a foreign visitor have been deliberately run over and killed or stabbed to death by Palestinians while about a dozen Palestinians have also been killed, including those accused of carrying out those attacks.

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.